Class: Geckoboard
- Inherits:
-
Object
- Object
- Geckoboard
- Defined in:
- lib/geckoboard.rb,
lib/geckoboard/version.rb
Constant Summary collapse
- VERSION =
"0.0.7"
Class Method Summary collapse
- .comparison(first, second) ⇒ Object
- .funnel(funnel_items, other_attributes = {}) ⇒ Object
- .funnel_item(label, value) ⇒ Object
- .geck_o_meter(value, max, min) ⇒ Object
- .gecko_item(text, value, other_attributes = {}) ⇒ Object
- .list_item(text, description, other_attributes = {}) ⇒ Object
- .number(text, value) ⇒ Object
- .pie(pie_items) ⇒ Object
- .pie_item(value, label, color = nil) ⇒ Object
- .rag(red, amber, green) ⇒ Object
- .trendline(text, value, trendline, gecko_item_attributes = {}) ⇒ Object
Class Method Details
.comparison(first, second) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/geckoboard.rb', line 25 def self.comparison(first, second) item: [ gecko_item('', first), gecko_item('', second) ] end |
.funnel(funnel_items, other_attributes = {}) ⇒ Object
52 53 54 |
# File 'lib/geckoboard.rb', line 52 def self.funnel(funnel_items, other_attributes = {}) ({item: funnel_items}.merge(other_attributes)) end |
.funnel_item(label, value) ⇒ Object
56 57 58 |
# File 'lib/geckoboard.rb', line 56 def self.funnel_item(label, value) gecko_item(nil, value, { label: label }) end |
.geck_o_meter(value, max, min) ⇒ Object
48 49 50 |
# File 'lib/geckoboard.rb', line 48 def self.geck_o_meter(value, max, min) item: value, max: max, min: min end |
.gecko_item(text, value, other_attributes = {}) ⇒ Object
6 7 8 9 10 |
# File 'lib/geckoboard.rb', line 6 def self.gecko_item(text, value, other_attributes = {}) { text: text, value: value }. merge(other_attributes). reject { |_, attribute_value| attribute_value.nil? } end |
.list_item(text, description, other_attributes = {}) ⇒ Object
32 33 34 |
# File 'lib/geckoboard.rb', line 32 def self.list_item text, description, other_attributes = {} other_attributes.merge({title: { text: text }, description: description.to_s}) end |
.number(text, value) ⇒ Object
19 20 21 22 23 |
# File 'lib/geckoboard.rb', line 19 def self.number(text, value) item: [ gecko_item(text, value) ] end |
.pie(pie_items) ⇒ Object
40 41 42 |
# File 'lib/geckoboard.rb', line 40 def self.pie pie_items item: pie_items end |
.pie_item(value, label, color = nil) ⇒ Object
44 45 46 |
# File 'lib/geckoboard.rb', line 44 def self.pie_item(value, label, color = nil) gecko_item(nil, value, { label: label, color: color }) end |
.rag(red, amber, green) ⇒ Object
36 37 38 |
# File 'lib/geckoboard.rb', line 36 def self.rag(red, amber, green) item: [red, amber, green] end |
.trendline(text, value, trendline, gecko_item_attributes = {}) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/geckoboard.rb', line 12 def self.trendline(text, value, trendline, gecko_item_attributes = {}) item: [ gecko_item(text, value, gecko_item_attributes), trendline ] end |