Class: Railjet::Context
- Inherits:
-
Object
- Object
- Railjet::Context
- Defined in:
- lib/railjet/context.rb
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ Context
constructor
A new instance of Context.
-
#method_missing(name, *args, &block) ⇒ Object
New values can be assigned to context on-the-fly, but it’s not possible to change anything.
Constructor Details
#initialize(**kwargs) ⇒ Context
Returns a new instance of Context.
3 4 5 |
# File 'lib/railjet/context.rb', line 3 def initialize(**kwargs) define_accessors(kwargs) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
New values can be assigned to context on-the-fly, but it’s not possible to change anything.
9 10 11 12 13 14 15 16 17 |
# File 'lib/railjet/context.rb', line 9 def method_missing(name, *args, &block) getter_name = name[0..-2] if name =~ /^[a-z]+=$/ && !respond_to?(getter_name) define_accessor(getter_name, args.first) else super end end |