Class: YTools::Path::ChildSelector
- Defined in:
- lib/ytools/path/selectors.rb
Instance Attribute Summary collapse
-
#child ⇒ Object
readonly
Returns the value of attribute child.
Attributes inherited from Selector
Instance Method Summary collapse
-
#initialize(child) ⇒ ChildSelector
constructor
A new instance of ChildSelector.
- #select(yaml) ⇒ Object
Methods inherited from Selector
Constructor Details
#initialize(child) ⇒ ChildSelector
Returns a new instance of ChildSelector.
27 28 29 |
# File 'lib/ytools/path/selectors.rb', line 27 def initialize(child) @child = child end |
Instance Attribute Details
#child ⇒ Object (readonly)
Returns the value of attribute child.
25 26 27 |
# File 'lib/ytools/path/selectors.rb', line 25 def child @child end |
Instance Method Details
#select(yaml) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ytools/path/selectors.rb', line 31 def select(yaml) if yaml.yhash.has_key?(child) value = yaml[child] if chained? subselector.select(value) else value end else nil end end |