zoneless_time 0.3.2 → 1.0

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.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in zoneless_time.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Shaun Mangelsdorf
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Shaun Mangelsdorf
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # ZonelessTime
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'zoneless_time'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install zoneless_time
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require "bundler/gem_tasks"
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ # Include hook code here
data/install.rb ADDED
@@ -0,0 +1 @@
1
+ # Install hook code here
data/lib/zoneless_time.rb CHANGED
@@ -5,6 +5,7 @@ require 'active_record/zoneless_time_support'
5
5
  require 'zoneless_time/time_without_zone'
6
6
  require 'zoneless_time/time_extension'
7
7
  require 'zoneless_time/date_extension'
8
+ require 'zoneless_time/quoting'
8
9
 
9
10
  Time.send :include, ZonelessTime::TimeExtension::InstanceMethods
10
11
  Date.send :include, ZonelessTime::DateExtension::InstanceMethods
@@ -0,0 +1,8 @@
1
+ module ZonelessTime
2
+ module Quoting
3
+ def quote(value, column=nil)
4
+ return "'#{value.to_s :db}'" if value.is_a? ZonelessTime::TimeWithoutZone
5
+ super(value, column)
6
+ end
7
+ end
8
+ end
@@ -6,6 +6,7 @@ module ZonelessTime
6
6
  initializer 'zoneless_time.configure_rails_initialization' do
7
7
  ActiveSupport::TimeWithZone.send :include, ZonelessTime::TimeExtension::InstanceMethods
8
8
  ActiveRecord::Base.send :extend, ActiveRecord::ZonelessTimeSupport
9
+ ActiveRecord::Base.connection.class.send :include, ZonelessTime::Quoting
9
10
 
10
11
  if config.active_record.time_zone_aware_attributes
11
12
  require 'zoneless_time/warning'
@@ -17,10 +17,18 @@ module ZonelessTime
17
17
  to_i > other.to_time.to_i
18
18
  end
19
19
 
20
+ def >=(other)
21
+ to_i >= other.to_time.to_i
22
+ end
23
+
20
24
  def <(other)
21
25
  to_i < other.to_time.to_i
22
26
  end
23
27
 
28
+ def <=(other)
29
+ to_i <= other.to_time.to_i
30
+ end
31
+
24
32
  def +(amount)
25
33
  (to_time + amount).without_zone
26
34
  end
@@ -0,0 +1,3 @@
1
+ module ZonelessTime
2
+ VERSION = "1.0"
3
+ end
data/uninstall.rb ADDED
@@ -0,0 +1 @@
1
+ # Uninstall hook code here
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/zoneless_time/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Shaun Mangelsdorf"]
6
+ gem.email = ["s.mangelsdorf@gmail.com"]
7
+ gem.description = %q{TimeWithoutZone support for ActiveRecord}
8
+ gem.summary = %q{TimeWithoutZone support for ActiveRecord}
9
+ gem.homepage = "https://github.com/smangelsdorf/zoneless_time"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "zoneless_time"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = ZonelessTime::VERSION
17
+ end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zoneless_time
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
+ - 1
7
8
  - 0
8
- - 3
9
- - 2
10
- version: 0.3.2
9
+ version: "1.0"
11
10
  platform: ruby
12
11
  authors:
13
12
  - Shaun Mangelsdorf
@@ -15,27 +14,40 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-09-25 00:00:00 Z
17
+ date: 2013-01-16 00:00:00 Z
19
18
  dependencies: []
20
19
 
21
- description:
20
+ description: TimeWithoutZone support for ActiveRecord
22
21
  email:
22
+ - s.mangelsdorf@gmail.com
23
23
  executables: []
24
24
 
25
25
  extensions: []
26
26
 
27
- extra_rdoc_files:
28
- - README
27
+ extra_rdoc_files: []
28
+
29
29
  files:
30
+ - .gitignore
31
+ - Gemfile
32
+ - LICENSE
33
+ - MIT-LICENSE
34
+ - README
35
+ - README.md
36
+ - Rakefile
37
+ - init.rb
38
+ - install.rb
30
39
  - lib/active_record/zoneless_time_support.rb
31
40
  - lib/zoneless_time.rb
32
41
  - lib/zoneless_time/date_extension.rb
42
+ - lib/zoneless_time/quoting.rb
33
43
  - lib/zoneless_time/railtie.rb
34
44
  - lib/zoneless_time/time_extension.rb
35
45
  - lib/zoneless_time/time_without_zone.rb
46
+ - lib/zoneless_time/version.rb
36
47
  - lib/zoneless_time/warning.rb
37
- - README
38
- homepage:
48
+ - uninstall.rb
49
+ - zoneless_time.gemspec
50
+ homepage: https://github.com/smangelsdorf/zoneless_time
39
51
  licenses: []
40
52
 
41
53
  post_install_message:
@@ -64,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
76
  requirements: []
65
77
 
66
78
  rubyforge_project:
67
- rubygems_version: 1.8.5
79
+ rubygems_version: 1.8.24
68
80
  signing_key:
69
81
  specification_version: 3
70
82
  summary: TimeWithoutZone support for ActiveRecord