Class: Etcher::Transformers::Root
- Inherits:
-
Object
- Object
- Etcher::Transformers::Root
- Defined in:
- lib/etcher/transformers/root.rb
Overview
Conditionally updates value based on path.
Instance Method Summary collapse
- #call(attributes) ⇒ Object
-
#initialize(key, fallback: Pathname.pwd) ⇒ Root
constructor
A new instance of Root.
Constructor Details
#initialize(key, fallback: Pathname.pwd) ⇒ Root
Returns a new instance of Root.
14 15 16 17 |
# File 'lib/etcher/transformers/root.rb', line 14 def initialize key, fallback: Pathname.pwd @key = key @fallback = fallback end |
Instance Method Details
#call(attributes) ⇒ Object
19 20 21 22 |
# File 'lib/etcher/transformers/root.rb', line 19 def call attributes value = attributes.fetch_value(key) { fallback } Success attributes.merge!(key => Pathname(value).) end |