Class: Stackup::ParameterStruct
- Inherits:
-
Object
- Object
- Stackup::ParameterStruct
- Defined in:
- lib/stackup/parameters.rb
Instance Attribute Summary collapse
-
#parameter_key ⇒ Object
(also: #key)
Returns the value of attribute parameter_key.
-
#parameter_value ⇒ Object
Returns the value of attribute parameter_value.
-
#use_previous_value ⇒ Object
Returns the value of attribute use_previous_value.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ ParameterStruct
constructor
A new instance of ParameterStruct.
- #value ⇒ Object
Constructor Details
#initialize(attributes) ⇒ ParameterStruct
Returns a new instance of ParameterStruct.
56 57 58 59 60 61 62 63 64 |
# 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_key ⇒ Object Also known as: key
Returns the value of attribute parameter_key.
66 67 68 |
# File 'lib/stackup/parameters.rb', line 66 def parameter_key @parameter_key end |
#parameter_value ⇒ Object
Returns the value of attribute parameter_value.
67 68 69 |
# File 'lib/stackup/parameters.rb', line 67 def parameter_value @parameter_value end |
#use_previous_value ⇒ Object
Returns the value of attribute use_previous_value.
68 69 70 |
# File 'lib/stackup/parameters.rb', line 68 def use_previous_value @use_previous_value end |
Instance Method Details
#value ⇒ Object
72 73 74 75 76 77 78 |
# File 'lib/stackup/parameters.rb', line 72 def value if use_previous_value :use_previous_value else parameter_value end end |