Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9186775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:36:51+00:00 2026-06-17T19:36:51+00:00

I was reading through Dalli’s source code and I found this… module ActionDispatch module

  • 0

I was reading through Dalli’s source code and I found this…

module ActionDispatch
  module Session
    class DalliStore < AbstractStore
      def initialize(app, options = {})
        # Support old :expires option
        options[:expire_after] ||= options[:expires]

        super

        @default_options = { :namespace => 'rack:session' }.merge(@default_options)

        @pool = options[:cache] || begin
          Dalli::Client.new(
              @default_options[:memcache_server], @default_options)
        end
        @namespace = @default_options[:namespace]

        @raise_errors = !!@default_options[:raise_errors]

        super
      end

      .... rest of class definition

What stood out to me is that super was called twice during initialize. I’ve never saw this sort of ruby idiom before. Why would you ever want to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:36:51+00:00Added an answer on June 17, 2026 at 7:36 pm

    So I went to the repo to hunt down AbstractStore which is part of rails’ actionpack. No initialize there so no behaviour that would warrant such a use. AbstractStore though also inherits from Rack::Session::Abstract::ID. Sure enough now we have the meat of it:

    def initialize(app, options={})
      @app = app
      @default_options = self.class::DEFAULT_OPTIONS.merge(options)
      @key = @default_options.delete(:key)
      @cookie_only = @default_options.delete(:cookie_only)
      initialize_sid
    end
    

    Looks like the first init is to get those instance variables set up. Then use and add to them which is unsurprising: the last super though… I’m gonna take a wild guess and say that it won’t do anything useful and is superfluous. I looked at core classes that inherit from AbstractStore and none of them uses multiple calls to super. Maybe a bug[1]. Open an issue on github and see where it leads.

    [1] This seems somewhat related

    EDIT: I have overlooked another thing though, super is on the last line and thus is the return value. This might actually be a better explanation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Reading through the Backbone.js source code, I saw this: validObj[attr] = void 0; What
I was reading through the source code for MeioUpload to make sure I understand
I'm reading through a open source Rails project code and I see SQL statements
Reading through a paper for the ARM Cortex-M3 CPU I found this line confusing:
When reading through this Async Sockets example , I find this code: // Get
Whilst reading through the DirectWrite source code I came across the following struct: ///
I've been reading through the source code for Moq and I came across the
When reading through parfib.hs code on github, I saw this comment about memory allocation
Reading through the C specs I found this function: double remquo(double x, double y,
Reading through this excellent article about safe construction techniques by Brain Goetz, I got

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.