Module: Meeseeks::Payload
- Defined in:
- lib/meeseeks/payload.rb
Class Method Summary collapse
- .for(metric, value, time = DateTime.now) ⇒ Object
- .for_group(group, metric, value, time) ⇒ Object
- .validate_type!(value) ⇒ Object
Class Method Details
.for(metric, value, time = DateTime.now) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/meeseeks/payload.rb', line 14 def self.for(metric, value, time = DateTime.now) { metric.to_s => { '_ts' => time.to_datetime.strftime('%Q').to_i, '_value' => value, '_type' => 'n' } } end |
.for_group(group, metric, value, time) ⇒ Object
8 9 10 11 12 |
# File 'lib/meeseeks/payload.rb', line 8 def self.for_group(group, metric, value, time) { group => self.for(metric, value, time) } end |
.validate_type!(value) ⇒ Object
24 25 26 27 28 |
# File 'lib/meeseeks/payload.rb', line 24 def self.validate_type!(value) return if value.is_a?(String) || value.is_a?(Numeric) raise Errors::InvalidType, "#{value.class.name} values are not supported" end |