Class: YTools::Path::Executor
- Inherits:
-
Object
- Object
- YTools::Path::Executor
- Defined in:
- lib/ytools/path/executor.rb
Instance Attribute Summary collapse
-
#selector ⇒ Object
readonly
Returns the value of attribute selector.
-
#yaml_object ⇒ Object
readonly
Returns the value of attribute yaml_object.
Instance Method Summary collapse
- #execute!(yaml_files, options) ⇒ Object
-
#initialize(path = nil, yaml_object = nil) ⇒ Executor
constructor
A new instance of Executor.
- #process! ⇒ Object
Constructor Details
Instance Attribute Details
#selector ⇒ Object (readonly)
Returns the value of attribute selector.
6 7 8 |
# File 'lib/ytools/path/executor.rb', line 6 def selector @selector end |
#yaml_object ⇒ Object (readonly)
Returns the value of attribute yaml_object.
6 7 8 |
# File 'lib/ytools/path/executor.rb', line 6 def yaml_object @yaml_object end |
Instance Method Details
#execute!(yaml_files, options) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ytools/path/executor.rb', line 13 def execute!(yaml_files, ) @yaml_object = [:yaml_object] if [:debug] STDERR.puts @yaml_object.to_s end @selector = [:selector] output = process! puts output if !output.empty? end |
#process! ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ytools/path/executor.rb', line 25 def process! found = @selector.select(yaml_object) if found.is_a?(YTools::YamlObject) show_yaml_object(found) elsif found.is_a?(Array) show_array(found) else found.to_s end end |