greenwich 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,6 +44,19 @@ module Greenwich #:nodoc:
44
44
  time_zone "#{name}_time_zone".to_sym, :for => name.to_sym if options[:time_zone] == time_zone_field
45
45
  end
46
46
 
47
+ def time_with_static_time_zone(name, options = {})
48
+ define_method "#{name}" do
49
+ time_field = Greenwich::Utilities.get_time_field(name, self.class.column_names)
50
+
51
+ instance_eval do
52
+ time = send(time_field.to_sym)
53
+ time_zone = Greenwich::Utilities.get_time_zone_from(send(options[:time_zone]))
54
+
55
+ ActiveSupport::TimeWithZone.new(nil, time_zone, time)
56
+ end
57
+ end
58
+ end
59
+
47
60
  def time_zone(name, options = {})
48
61
  options[:for] = [options[:for]].compact unless options[:for].is_a? Array
49
62
  options[:for].map! { |v| [v, Greenwich::Utilities.get_time_field(v, column_names)] }
@@ -1,3 +1,3 @@
1
1
  module Greenwich
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,72 +1,74 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: greenwich
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.4
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 0.0.5
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - thekompanee
9
9
  - jfelchner
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-07-31 00:00:00.000000000 -05:00
13
+
14
+ date: 2011-09-30 00:00:00 -05:00
14
15
  default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
17
18
  name: activerecord
18
- requirement: &2172743720 !ruby/object:Gem::Requirement
19
+ prerelease: false
20
+ requirement: &id001 !ruby/object:Gem::Requirement
19
21
  none: false
20
- requirements:
22
+ requirements:
21
23
  - - ~>
22
- - !ruby/object:Gem::Version
23
- version: '3.0'
24
+ - !ruby/object:Gem::Version
25
+ version: "3.0"
24
26
  type: :runtime
25
- prerelease: false
26
- version_requirements: *2172743720
27
- - !ruby/object:Gem::Dependency
27
+ version_requirements: *id001
28
+ - !ruby/object:Gem::Dependency
28
29
  name: bundler
29
- requirement: &2172743220 !ruby/object:Gem::Requirement
30
+ prerelease: false
31
+ requirement: &id002 !ruby/object:Gem::Requirement
30
32
  none: false
31
- requirements:
33
+ requirements:
32
34
  - - ~>
33
- - !ruby/object:Gem::Version
34
- version: '1.0'
35
+ - !ruby/object:Gem::Version
36
+ version: "1.0"
35
37
  type: :development
36
- prerelease: false
37
- version_requirements: *2172743220
38
- - !ruby/object:Gem::Dependency
38
+ version_requirements: *id002
39
+ - !ruby/object:Gem::Dependency
39
40
  name: rspec
40
- requirement: &2172742760 !ruby/object:Gem::Requirement
41
+ prerelease: false
42
+ requirement: &id003 !ruby/object:Gem::Requirement
41
43
  none: false
42
- requirements:
44
+ requirements:
43
45
  - - ~>
44
- - !ruby/object:Gem::Version
45
- version: '2.6'
46
+ - !ruby/object:Gem::Version
47
+ version: "2.6"
46
48
  type: :development
47
- prerelease: false
48
- version_requirements: *2172742760
49
- - !ruby/object:Gem::Dependency
49
+ version_requirements: *id003
50
+ - !ruby/object:Gem::Dependency
50
51
  name: yard
51
- requirement: &2172742300 !ruby/object:Gem::Requirement
52
+ prerelease: false
53
+ requirement: &id004 !ruby/object:Gem::Requirement
52
54
  none: false
53
- requirements:
55
+ requirements:
54
56
  - - ~>
55
- - !ruby/object:Gem::Version
56
- version: '0.7'
57
+ - !ruby/object:Gem::Version
58
+ version: "0.7"
57
59
  type: :development
58
- prerelease: false
59
- version_requirements: *2172742300
60
- description: Store all of your times in the database as UTC but want to give your
61
- users the ability to choose a custom time zone for each instance of a DateTime field?
62
- email:
60
+ version_requirements: *id004
61
+ description: Store all of your times in the database as UTC but want to give your users the ability to choose a custom time zone for each instance of a DateTime field?
62
+ email:
63
63
  - support@thekompanee.com
64
64
  executables: []
65
+
65
66
  extensions: []
66
- extra_rdoc_files:
67
+
68
+ extra_rdoc_files:
67
69
  - README.md
68
70
  - LICENSE
69
- files:
71
+ files:
70
72
  - .gitignore
71
73
  - .rspec
72
74
  - .rvmrc
@@ -85,29 +87,31 @@ files:
85
87
  has_rdoc: true
86
88
  homepage: http://github.com/jfelchner/greenwich
87
89
  licenses: []
90
+
88
91
  post_install_message:
89
- rdoc_options:
92
+ rdoc_options:
90
93
  - --charset = UTF-8
91
- require_paths:
94
+ require_paths:
92
95
  - lib
93
- required_ruby_version: !ruby/object:Gem::Requirement
96
+ required_ruby_version: !ruby/object:Gem::Requirement
94
97
  none: false
95
- requirements:
96
- - - ! '>='
97
- - !ruby/object:Gem::Version
98
- version: '0'
99
- required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: "0"
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
103
  none: false
101
- requirements:
102
- - - ! '>='
103
- - !ruby/object:Gem::Version
104
- version: '0'
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: "0"
105
108
  requirements: []
109
+
106
110
  rubyforge_project: greenwich
107
111
  rubygems_version: 1.6.2
108
112
  signing_key:
109
113
  specification_version: 3
110
114
  summary: Allowing users to select dates with custom time zones since 2011.
111
- test_files:
115
+ test_files:
112
116
  - spec/greenwich/utilities_spec.rb
113
117
  - spec/spec_helper.rb