Class: Collins::PowerUnit
Constant Summary
Constants included from Util::Logging
Util::Logging::DEFAULT_LOG_FORMAT
Instance Attribute Summary collapse
-
#is_required ⇒ Object
Returns the value of attribute is_required.
-
#key ⇒ Object
Returns the value of attribute key.
-
#label ⇒ Object
Returns the value of attribute label.
-
#position ⇒ Object
Returns the value of attribute position.
-
#type ⇒ Object
Returns the value of attribute type.
-
#unique ⇒ Object
Returns the value of attribute unique.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(model = {}) ⇒ PowerUnit
constructor
A new instance of PowerUnit.
- #is_required? ⇒ Boolean
- #unique? ⇒ Boolean
Methods included from Util
#deep_copy_hash, #get_asset_or_tag, included, #require_non_empty, #require_that, #stringify_hash, #symbolize_hash
Methods included from Util::Logging
Constructor Details
#initialize(model = {}) ⇒ PowerUnit
Returns a new instance of PowerUnit.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/collins/power.rb', line 12 def initialize model = {} hash = symbolize_hash(model).inject({}) do |result, (k,v)| result[k.downcase] = v result end @key = hash[:key].to_s @value = hash[:value].to_s @type = hash[:type].to_s @label = hash[:label].to_s @position = hash[:position].to_s.to_i @is_required = hash[:is_required] @unique = hash[:unique] end |
Instance Attribute Details
#is_required ⇒ Object
Returns the value of attribute is_required.
10 11 12 |
# File 'lib/collins/power.rb', line 10 def is_required @is_required end |
#key ⇒ Object
Returns the value of attribute key.
10 11 12 |
# File 'lib/collins/power.rb', line 10 def key @key end |
#label ⇒ Object
Returns the value of attribute label.
10 11 12 |
# File 'lib/collins/power.rb', line 10 def label @label end |
#position ⇒ Object
Returns the value of attribute position.
10 11 12 |
# File 'lib/collins/power.rb', line 10 def position @position end |
#type ⇒ Object
Returns the value of attribute type.
10 11 12 |
# File 'lib/collins/power.rb', line 10 def type @type end |
#unique ⇒ Object
Returns the value of attribute unique.
10 11 12 |
# File 'lib/collins/power.rb', line 10 def unique @unique end |
#value ⇒ Object
Returns the value of attribute value.
10 11 12 |
# File 'lib/collins/power.rb', line 10 def value @value end |
Instance Method Details
#is_required? ⇒ Boolean
26 27 28 |
# File 'lib/collins/power.rb', line 26 def is_required? @is_required == true end |
#unique? ⇒ Boolean
29 30 31 |
# File 'lib/collins/power.rb', line 29 def unique? @unique == true end |