google_otg 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/google_otg.gemspec +1 -1
  3. data/lib/google_otg.rb +7 -6
  4. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.10
1
+ 1.0.11
data/google_otg.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{google_otg}
8
- s.version = "1.0.10"
8
+ s.version = "1.0.11"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["esilverberg"]
data/lib/google_otg.rb CHANGED
@@ -205,9 +205,10 @@ eos
205
205
  }
206
206
 
207
207
  tz = args.has_key?(:time_zone) ? args[:time_zone] : ActiveSupport::TimeZone['UTC']
208
- Time.zone = tz
209
208
  label = args.has_key?(:label) ? args[:label] : "Value"
210
- time_fn = args.has_key?(:time_fn) ? args[:time_fn] : lambda {|h| h.created_at }
209
+ time_fn = args.has_key?(:time_fn) ? args[:time_fn] : lambda {|h|
210
+ return tz.local(h.created_at.year, h.created_at.month, h.created_at.day, h.created_at.hour, h.created_at.min, h.created_at.sec) # create zoned time
211
+ }
211
212
  range = args.has_key?(:range) ? args[:range] : DEFAULT_RANGE
212
213
  x_label_format = args.has_key?(:x_label_format) ? args[:x_label_format] : "%A %I:%M%p"
213
214
 
@@ -222,9 +223,9 @@ eos
222
223
  points = []
223
224
  point_dates = []
224
225
 
225
- now_days = Time.now # use this get the right year, month and day
226
- now_minutes = Time.at((Time.now.to_i/(60*range))*(60*range)).gmtime
227
- now_floored = Time.local(now_days.year, now_days.month, now_days.day,
226
+ now_days = tz.now # use this get the right year, month and day
227
+ now_minutes = tz.at((now_days.to_i/(60*range))*(60*range)).gmtime
228
+ now_floored = tz.local(now_days.year, now_days.month, now_days.day,
228
229
  now_minutes.hour, now_minutes.min, now_minutes.sec)
229
230
 
230
231
  current = hits.length > 0 ? time_fn.call(hits[0]) : now_floored
@@ -267,7 +268,7 @@ eos
267
268
  max_x_label_count = args.has_key?(:max_x_label_count) ? args[:max_x_label_count] : points.length
268
269
 
269
270
  if points.length > 0
270
- step = points.length / max_x_label_count
271
+ step = [points.length / max_x_label_count, 1].max
271
272
  idx = 0
272
273
 
273
274
  while idx < points.length
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_otg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - esilverberg