Class: CloudRailSi::ServiceCode::StringTransform
- Inherits:
-
Object
- Object
- CloudRailSi::ServiceCode::StringTransform
- Defined in:
- lib/cloudrail_si/servicecode/commands/string/StringTransform.rb
Instance Method Summary collapse
- #execute(environment, parameters) ⇒ Object
- #get_identifier ⇒ Object
-
#initialize(identifier, transform) ⇒ StringTransform
constructor
A new instance of StringTransform.
Constructor Details
#initialize(identifier, transform) ⇒ StringTransform
Returns a new instance of StringTransform.
6 7 8 9 |
# File 'lib/cloudrail_si/servicecode/commands/string/StringTransform.rb', line 6 def initialize(identifier, transform) @identifier = identifier @transform = transform end |
Instance Method Details
#execute(environment, parameters) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cloudrail_si/servicecode/commands/string/StringTransform.rb', line 15 def execute(environment, parameters) Helper.assert(parameters.length === 2 && Helper.is_var_address(parameters[0])) result_var = parameters[0] source_string = Helper.resolve(environment, parameters[1]) Helper.assert(Helper.is_string(source_string)) res = @transform.call(source_string) environment.set_variable(result_var, res) end |
#get_identifier ⇒ Object
11 12 13 |
# File 'lib/cloudrail_si/servicecode/commands/string/StringTransform.rb', line 11 def get_identifier @identifier end |