Module: GraphiteMetric::Util

Extended by:
Util
Included in:
Raw, Util
Defined in:
lib/graphite-metric/util.rb

Instance Method Summary collapse

Instance Method Details

#extract_headers(raw_headers) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/graphite-metric/util.rb', line 11

def extract_headers(raw_headers)
  all_splits = raw_headers.split(",")
  step = all_splits.pop
  to = all_splits.pop
  from = all_splits.pop
  metric_name = all_splits.join(",")

  [metric_name, from, to, step]
end

#float(raw_metric) ⇒ Object



5
6
7
8
9
# File 'lib/graphite-metric/util.rb', line 5

def float(raw_metric)
  Float(raw_metric)
rescue
  0.0
end