timescopes 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33459f5097d5d9f3b5c4f180c3ddf9ebf259544a
4
- data.tar.gz: a582cf895357b9ff22e43d5d70b733376119de96
3
+ metadata.gz: 752aca084979b6cf8f7accb289f263ffe3199fd3
4
+ data.tar.gz: cf83c98deb5a85670346a582eb5ba372e5fce76d
5
5
  SHA512:
6
- metadata.gz: cc86d6dc4b3eee7ac2c62fb5e53f10484804c22202dc2c0c3cd1eef785e971cbb3fb64d0bf22ed6dde3965a837f5bcca11396aaa05dd08c798e9b00cb143dd4d
7
- data.tar.gz: 0079a6bb100bd3f15115422a8c6ebf7d2c11453ed7fa21c8cf3b168a04c7479f86081f4cccea955c8ed5ca042721e6058c02fb5c8316c842893ce77879f39ebc
6
+ metadata.gz: 6d983876cfe71225d424739fadabd93c48520aa68ae8b94e2094c934535cafe1562f057fee9cb27e2b5cabe3d5fd8c5316155be2ef49145335b3b4d5bca8346e
7
+ data.tar.gz: 435ed29a6550208042181e3b73f69a0626160f3b395f46d5ac6746d089c50e2450c17321698e32f403a4ed1b62f2e06878806c367d1f415aea4107af875f6dad
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -5,7 +5,7 @@ module TimeScopes
5
5
 
6
6
  module ClassMethods
7
7
  def timescoped!(opts={})
8
- default_scopes = [:daily, :weekly, :monthly]
8
+ default_scopes = [:hourly, :daily, :weekly, :monthly]
9
9
 
10
10
  field = opts[:field] || "created_at"
11
11
  scopes = if opts[:only]
@@ -2,6 +2,12 @@ require 'chronic'
2
2
 
3
3
  module TimeScopes
4
4
  class << self
5
+ def hourly(start=nil)
6
+ start ||= Time.now
7
+ [ Chronic.parse(start.strftime("%Y-%m-%d #{start.hour}:00:00Z")),
8
+ Chronic.parse(start.strftime("%Y-%m-%d #{start.hour}:59:59Z")) ]
9
+ end
10
+
5
11
  def daily(start=nil)
6
12
  start ||= Time.now
7
13
  [ Chronic.parse(start_of_day(start.utc)),
data/timescopes.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: timescopes 0.1.1 ruby lib
5
+ # stub: timescopes 0.1.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "timescopes"
9
- s.version = "0.1.1"
9
+ s.version = "0.1.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Ian Hunter"]
14
- s.date = "2015-10-31"
14
+ s.date = "2015-11-15"
15
15
  s.description = ""
16
16
  s.email = "ianhunter@gmail.com"
17
17
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timescopes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Hunter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-31 00:00:00.000000000 Z
11
+ date: 2015-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chronic