Sha256: 87f0d16c437bdd01257b3aa91581caaf78f8186044cde0626d4e44cb9cab0a59
Contents?: true
Size: 706 Bytes
Versions: 2
Compression:
Stored size: 706 Bytes
Contents
# helpers for processing params and validating input module BatsdDash module ParamsHelper def parse_metrics metrics = params[:metrics] metrics = [metrics] unless Array === metrics metrics.tap { |list| list.reject! { |m| m.nil? || m.empty? } } end def parse_time_range start, stop = params[:start], params[:stop] if start.nil? && stop.nil? now = Time.now.to_i # 1 hr range # TODO make this setting? [ now - 3600 + 1, now ] else [start.to_i, stop.to_i].tap do |range| if range[0] <= 0 || range[1] <= 0 || range[0] >= range[1] return nil end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
batsd-dash-0.2.1 | lib/batsd-dash/params.rb |
batsd-dash-0.2.0 | lib/batsd-dash/params.rb |