Class: Stackup::ParameterStruct

Inherits:
Object
  • Object
show all
Defined in:
lib/stackup/parameters.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ ParameterStruct

Returns a new instance of ParameterStruct.



56
57
58
59
60
61
62
63
# File 'lib/stackup/parameters.rb', line 56

def initialize(attributes)
  attributes.each do |name, value|
    name = name.gsub(/([a-z])([A-Z])/, '\1_\2').downcase if name.respond_to?(:gsub)
    writer = "#{name}="
    raise(ArgumentError, "invalid attribute: #{name.inspect}") unless respond_to?(writer)
    public_send(writer, value)
  end
end

Instance Attribute Details

#parameter_keyObject Also known as: key

Returns the value of attribute parameter_key.



65
66
67
# File 'lib/stackup/parameters.rb', line 65

def parameter_key
  @parameter_key
end

#parameter_valueObject

Returns the value of attribute parameter_value.



66
67
68
# File 'lib/stackup/parameters.rb', line 66

def parameter_value
  @parameter_value
end

#use_previous_valueObject

Returns the value of attribute use_previous_value.



67
68
69
# File 'lib/stackup/parameters.rb', line 67

def use_previous_value
  @use_previous_value
end

Instance Method Details

#valueObject



71
72
73
74
75
76
77
# File 'lib/stackup/parameters.rb', line 71

def value
  if use_previous_value
    :use_previous_value
  else
    parameter_value
  end
end