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.
58 59 60 61 62 63 64 65 66 |
# File 'lib/stackup/parameters.rb', line 58 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.
68 69 70 |
# File 'lib/stackup/parameters.rb', line 68 def parameter_key @parameter_key end |
#parameter_value ⇒ Object
Returns the value of attribute parameter_value.
69 70 71 |
# File 'lib/stackup/parameters.rb', line 69 def parameter_value @parameter_value end |
#use_previous_value ⇒ Object
Returns the value of attribute use_previous_value.
70 71 72 |
# File 'lib/stackup/parameters.rb', line 70 def use_previous_value @use_previous_value end |
Instance Method Details
#value ⇒ Object
74 75 76 77 78 79 80 |
# File 'lib/stackup/parameters.rb', line 74 def value if use_previous_value :use_previous_value else parameter_value end end |