Class: TableSaw::VariableInterpolation

Inherits:
Object
  • Object
show all
Defined in:
lib/table_saw/variable_interpolation.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ VariableInterpolation

Returns a new instance of VariableInterpolation.



11
12
13
# File 'lib/table_saw/variable_interpolation.rb', line 11

def initialize(input)
  @input = input
end

Instance Attribute Details

#inputObject (readonly)

Returns the value of attribute input.



9
10
11
# File 'lib/table_saw/variable_interpolation.rb', line 9

def input
  @input
end

Class Method Details

.call(variables) ⇒ Object



5
6
7
# File 'lib/table_saw/variable_interpolation.rb', line 5

def self.call(variables)
  new(variables).call
end

Instance Method Details

#callObject



15
16
17
18
19
20
21
# File 'lib/table_saw/variable_interpolation.rb', line 15

def call
  input.transform_values do |value|
    next value unless value.is_a?(String)

    interpolate_variables(value, input)
  end
end