Class: HammerCLI::Options::ProcessorList
- Inherits:
-
Array
- Object
- Array
- HammerCLI::Options::ProcessorList
- Defined in:
- lib/hammer_cli/options/processor_list.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #find_by_name(name) ⇒ Object
-
#initialize(sources = [], name: nil) ⇒ ProcessorList
constructor
A new instance of ProcessorList.
- #insert_relative(mode, target_name, processor) ⇒ Object
- #process(defined_options, result) ⇒ Object
Constructor Details
#initialize(sources = [], name: nil) ⇒ ProcessorList
Returns a new instance of ProcessorList.
6 7 8 9 |
# File 'lib/hammer_cli/options/processor_list.rb', line 6 def initialize(sources = [], name: nil) @name = name self.push(*sources) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/hammer_cli/options/processor_list.rb', line 4 def name @name end |
Instance Method Details
#find_by_name(name) ⇒ Object
16 17 18 |
# File 'lib/hammer_cli/options/processor_list.rb', line 16 def find_by_name(name) self[item_index(name)] end |
#insert_relative(mode, target_name, processor) ⇒ Object
11 12 13 14 |
# File 'lib/hammer_cli/options/processor_list.rb', line 11 def insert_relative(mode, target_name, processor) index = target_name.nil? ? nil : item_index(target_name) HammerCLI.insert_relative(self, mode, index, processor) end |
#process(defined_options, result) ⇒ Object
20 21 22 23 24 |
# File 'lib/hammer_cli/options/processor_list.rb', line 20 def process(, result) self.inject(result) do |, processor| processor.process(, ) end end |