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