Class: SuperCurrent::SuperSuperCurrent
- Inherits:
-
ActiveSupport::CurrentAttributes
- Object
- ActiveSupport::CurrentAttributes
- SuperCurrent::SuperSuperCurrent
- Defined in:
- lib/super_current.rb
Overview
The class that actually has the CurrentAttributes as parent class Named SuperSuperCurrent to avoid conflicts with the SuperCurrent module
Class Method Summary collapse
- .[](key) ⇒ Object
- .[]=(key, value) ⇒ Object
- .method_missing(method, *args) ⇒ Object
- .respond_to_missing?(method, include_private = false) ⇒ Boolean
Class Method Details
.[](key) ⇒ Object
20 21 22 23 |
# File 'lib/super_current.rb', line 20 def self.[](key) self.__current_hash ||= {} self.__current_hash[key] || self.__current_hash[key] = {} end |
.[]=(key, value) ⇒ Object
25 26 27 28 |
# File 'lib/super_current.rb', line 25 def self.[]=(key, value) self.__current_hash ||= {} self.__current_hash[key] = value end |
.method_missing(method, *args) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/super_current.rb', line 30 def self.method_missing(method, *args) super unless method.to_s.end_with?("=") attribute_name = method.to_s.chomp("=") attribute_value = args.first class_eval { attribute attribute_name.to_sym } public_send "#{attribute_name}=", attribute_value @methods << attribute_name end |
.respond_to_missing?(method, include_private = false) ⇒ Boolean
41 42 43 |
# File 'lib/super_current.rb', line 41 def self.respond_to_missing?(method, include_private = false) @methods.include?(method.to_s) || method.to_s.end_with?("=") || super end |