Class: Yew::Tree
- Inherits:
- BasicObject
- Defined in:
- lib/yew.rb
Overview
The object tree. Allows root-to-leave navigation in the form of ordinary method calls.
Instance Method Summary collapse
-
#[](*key) ⇒ Yew::Tree, ...
Fetches a branch or leaf.
-
#initialize(env, root = nil) ⇒ Tree
constructor
A new instance of Tree.
- #inspect ⇒ Object
- #method_missing(m, *attrs, &block) ⇒ Object
- #to_s ⇒ Object
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Method Details
#[](*key) ⇒ Yew::Tree, ...
Fetches a branch or leaf.
If no key is received, returns the underlying Hash.
37 38 39 40 41 42 43 44 45 |
# File 'lib/yew.rb', line 37 def [](*key) if key.any? key = key.first Utils.fetch(key, @env, @root) else @env end end |
#inspect ⇒ Object
53 54 55 |
# File 'lib/yew.rb', line 53 def inspect "<Yew::Env:#{__id__} -> #@env>" end |
#to_s ⇒ Object
57 58 59 |
# File 'lib/yew.rb', line 57 def to_s "Env -> #@env" end |