Class: KPI::Entry
- Inherits:
-
Object
- Object
- KPI::Entry
- Defined in:
- app/models/kpi/entry.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#important ⇒ Object
readonly
Returns the value of attribute important.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#unit ⇒ Object
readonly
Returns the value of attribute unit.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #important? ⇒ Boolean
-
#initialize(*args) ⇒ Entry
constructor
A new instance of Entry.
- #to_a ⇒ Object
Constructor Details
#initialize(*args) ⇒ Entry
Returns a new instance of Entry.
4 5 6 7 8 9 10 11 |
# File 'app/models/kpi/entry.rb', line 4 def initialize(*args) = args. raise ArgumentError, "Wrong number of arguments (#{args.count} of 2)" unless args.count == 2 @name, @value = args @description = [:description] @important = [:important] || false @unit = [:unit] end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'app/models/kpi/entry.rb', line 3 def description @description end |
#important ⇒ Object (readonly)
Returns the value of attribute important.
3 4 5 |
# File 'app/models/kpi/entry.rb', line 3 def important @important end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'app/models/kpi/entry.rb', line 3 def name @name end |
#unit ⇒ Object (readonly)
Returns the value of attribute unit.
3 4 5 |
# File 'app/models/kpi/entry.rb', line 3 def unit @unit end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'app/models/kpi/entry.rb', line 3 def value @value end |
Instance Method Details
#important? ⇒ Boolean
13 14 15 |
# File 'app/models/kpi/entry.rb', line 13 def important? !!self.important end |
#to_a ⇒ Object
17 18 19 |
# File 'app/models/kpi/entry.rb', line 17 def to_a [@title, @value, @description, @unit].compact end |