Class: LazyDoc::Commands::ViaCommand
- Inherits:
-
Object
- Object
- LazyDoc::Commands::ViaCommand
- Defined in:
- lib/lazy_doc/commands/via_command.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #execute(document) ⇒ Object
-
#initialize(path) ⇒ ViaCommand
constructor
A new instance of ViaCommand.
Constructor Details
#initialize(path) ⇒ ViaCommand
Returns a new instance of ViaCommand.
5 6 7 |
# File 'lib/lazy_doc/commands/via_command.rb', line 5 def initialize(path) @path = [path].flatten end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/lazy_doc/commands/via_command.rb', line 3 def path @path end |
Instance Method Details
#execute(document) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/lazy_doc/commands/via_command.rb', line 9 def execute(document) path.inject(document) do |sub_document, attribute| attribute_identifier = determine_attribute_identifier(attribute, sub_document) sub_document[attribute_identifier] end end |