Class: Lite::Component::Locals
- Inherits:
-
Object
- Object
- Lite::Component::Locals
- Defined in:
- lib/lite/component/locals.rb
Instance Attribute Summary collapse
-
#locals ⇒ Object
(also: #to_hash, #to_h)
readonly
Returns the value of attribute locals.
Instance Method Summary collapse
-
#initialize(locals) ⇒ Locals
constructor
A new instance of Locals.
Constructor Details
#initialize(locals) ⇒ Locals
Returns a new instance of Locals.
12 13 14 |
# File 'lib/lite/component/locals.rb', line 12 def initialize(locals) @locals = (locals || {}).symbolize_keys end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *arguments, &block) ⇒ Object (private)
18 19 20 21 22 23 24 |
# File 'lib/lite/component/locals.rb', line 18 def method_missing(method_name, *arguments, &block) if locals.key?(method_name) locals[method_name] else super end end |
Instance Attribute Details
#locals ⇒ Object (readonly) Also known as: to_hash, to_h
Returns the value of attribute locals.
7 8 9 |
# File 'lib/lite/component/locals.rb', line 7 def locals @locals end |