Class: AocCli::Processors::ResourceAttacher
- Inherits:
-
Core::Processor
- Object
- Core::Processor
- AocCli::Processors::ResourceAttacher
- Extended by:
- Forwardable
- Defined in:
- lib/aoc_cli/processors/resource_attacher.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
-
#resource ⇒ Object
Returns the value of attribute resource.
Instance Method Summary collapse
Methods inherited from Core::Processor
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/aoc_cli/processors/resource_attacher.rb', line 6 def path @path end |
#resource ⇒ Object
Returns the value of attribute resource.
6 7 8 |
# File 'lib/aoc_cli/processors/resource_attacher.rb', line 6 def resource @resource end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/aoc_cli/processors/resource_attacher.rb', line 11 def run if location.nil? Location.create(resource:, path:) else location&.update(path:) || location end.tap { resource.reload } end |