set_watch_for 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/set_watch_for.rb +17 -0
  2. metadata +45 -0
@@ -0,0 +1,17 @@
1
+ def set_watch_for(*attr_names)
2
+
3
+ if attr_names[1][:local_to].eql? :self
4
+ time_zone_method = "time_zone"
5
+ else
6
+ time_zone_method = "self.#{attr_names[1][:local_to]}.time_zone"
7
+ end
8
+
9
+ method_suffix = attr_names[1][:local_to]
10
+ method_suffix = attr_names[1][:as] unless attr_names[1][:as].blank?
11
+
12
+ class_eval(<<-EOS, __FILE__, __LINE__)
13
+ def #{attr_names[0]}_local_to_#{method_suffix}
14
+ #{attr_names[0]}.in_time_zone(#{time_zone_method})
15
+ end
16
+ EOS
17
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: set_watch_for
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Gary Moore
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-12-02 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: Showing local times
15
+ email: gary.moore@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/set_watch_for.rb
21
+ homepage: http://github.com/fracturedatlas/set_watch_for
22
+ licenses: []
23
+ post_install_message:
24
+ rdoc_options: []
25
+ require_paths:
26
+ - lib
27
+ required_ruby_version: !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 1.8.10
42
+ signing_key:
43
+ specification_version: 3
44
+ summary: Showing local times
45
+ test_files: []