gemhome / fnordmetric

(possible new home for) FnordMetric is a redis/ruby-based realtime Event-Tracking app
0 stars 1 forks source link

Timeseries Widget: convert tick Enum to Arr for .last #70

Open bf4 opened 10 years ago

bf4 commented 10 years ago

Issue by anapsix Thursday Aug 22, 2013 at 17:38 GMT Originally opened as https://github.com/paulasmuth/fnordmetric/pull/164


Avoid NoMethodError on tick.last by converting it to array

NoMethodError - undefined method `last' for #<Enumerator: 1377191030..1377191330:step(10)>
/var/lib/gems/1.9.1/gems/fnordmetric-1.2.9/lib/fnordmetric/widgets/timeseries_widget.rb:35:in `data'
/var/lib/gems/1.9.1/gems/fnordmetric-1.2.9/lib/fnordmetric/widget.rb:75:in `render'

anapsix included the following code: https://github.com/paulasmuth/fnordmetric/pull/164/commits

bf4 commented 10 years ago

Comment by localhots Monday Sep 02, 2013 at 10:43 GMT


:+1:

bf4 commented 10 years ago

Comment by elia Thursday Sep 05, 2013 at 09:52 GMT


:+1:

bf4 commented 10 years ago

Comment by elia Thursday Sep 05, 2013 at 09:55 GMT


For a quick fix add the following code on the top of your file:

module Enumerable
  def last
    to_a.last
  end
end