Sha256: 5695b758c0b496cc3cdcab7cd7e12aafaa6ec16ddecb232124819b02826e0470

Contents?: true

Size: 789 Bytes

Versions: 1

Compression:

Stored size: 789 Bytes

Contents

module MicroSessions
  module Controller
    extend ActiveSupport::Concern

    module ClassMethods
      def micro_sessions(options = {})
        options.stringify_keys!
        options.assert_valid_keys(:param, :param_type, :key, :length, :counter)

        options[:param] ||= "_msid"
        options[:key] ||= "_micro_sessions"
        options[:param_type] ||= :hash
        options[:length] ||= 10
        options[:counter] ||= 1

        class_attribute :micro_session_options
        self.micro_session_options = options

        class_eval do
          def micro_session
            @micro_session ||= MicroSessions::MicroSession.new(self)
          end

          helper_method :micro_session
          helper_method :micro_session_options
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
micro_sessions-0.3.0 lib/micro_sessions/controller.rb