zodiac 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 54b14cc9a9d4cc8ce59f0764a494921b943857d9
4
+ data.tar.gz: 1dfb4499a9969fba2e555c8c1c2872b5417e1add
5
+ SHA512:
6
+ metadata.gz: 2b6cba96f3aa249b5613705320db9aa535ad6d8ef8df2eb745511176a606c9fc3bf369c92b6bcb367d970817160cce55ecac89f1d8b759498da861aa0cc44450
7
+ data.tar.gz: 342246bada416a98d2a5821b2b78a977fe8ea0f44030056f2ba1e18460a9b57360dadeac7d2248cae5543046ea314b090ca55e5505b00c599ac94946d80a8a26
data/.travis.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  rvm:
2
- - 1.8.7
3
2
  - 1.9.2
4
3
  - 1.9.3
4
+ - 2.0.0
data/README.md CHANGED
@@ -84,7 +84,7 @@ If you don't like the name of the field containing zodiac sign (by default it's
84
84
 
85
85
  ``` ruby
86
86
  class Person < ActiveRecord::Base
87
- zodiac_reader :dob, :sign_id_attribute => :custom_sign_id
87
+ zodiac_reader :dob, sign_id_attribute: :custom_sign_id
88
88
  end
89
89
  ```
90
90
 
@@ -112,6 +112,7 @@ rails generate zodiac:migration Person custom_sign_id
112
112
  * 0.2.3 Added Spanish locale (thanks [jazminschroeder](https://github.com/jazminschroeder))
113
113
  * 0.2.4 Correct leap-year dates handling (thanks [BastienDuplessier](https://github.com/BastienDuplessier))
114
114
  * 0.2.5 Added German locale (thanks [contradictioned](https://github.com/contradictioned))
115
+ * 0.2.6 Added rails 4.0 support (thanks [travisp](https://github.com/travisp))
115
116
 
116
117
  ## Roadmap
117
118
 
@@ -119,8 +120,6 @@ rails generate zodiac:migration Person custom_sign_id
119
120
 
120
121
  2. Other ORMs support (DataMapper, Sequel, Mongoid)
121
122
 
122
- 3. ActiveRecord 4.0 support (extending AR::Model instead of AR::Base)
123
-
124
123
  ## Contributing
125
124
 
126
125
  Fork the repository, push your changes to a topic branch and send me a pull request.
@@ -1,12 +1,13 @@
1
1
  module Zodiac
2
2
  class MigrationGenerator < Rails::Generators::Base
3
3
  source_root File.expand_path('../templates', __FILE__)
4
- argument :model_name, :type => :string
5
- argument :sign_attribute, :type => :string, :default => 'zodiac_sign_id'
4
+ argument :model_name, type: :string
5
+ argument :sign_attribute, type: :string, default: 'zodiac_sign_id'
6
6
 
7
7
  def copy_files
8
8
  template template_name, "db/migrate/#{migration_filename}.rb"
9
9
  end
10
+
10
11
  private
11
12
  def template_name
12
13
  if Rails.version < '3.1'
data/lib/zodiac.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'funtimes'
2
2
  require 'i18n'
3
- I18n.config.load_path += Dir.glob(File.dirname(File.expand_path(__FILE__)) + '/locales/*.yml')
3
+ I18n.config.load_path += Dir.glob(File.expand_path('../locales', __FILE__) + '/*.yml')
4
4
 
5
5
  require 'zodiac/finder'
6
6
 
@@ -13,6 +13,7 @@ module Zodiac
13
13
  self.send(self.class.date_for_zodiac).try(method_name)
14
14
  end
15
15
  end
16
+
16
17
  private
17
18
  def update_sign_id
18
19
  sign_id_method = "#{self.class.zodiac_sign_id_field}="
@@ -24,7 +25,7 @@ module Zodiac
24
25
  module ClassMethods
25
26
  attr_reader :date_for_zodiac, :zodiac_sign_id_field
26
27
 
27
- def zodiac_reader(dob_attribute, options = {:sign_id_attribute => :zodiac_sign_id})
28
+ def zodiac_reader(dob_attribute, options = { sign_id_attribute: :zodiac_sign_id })
28
29
  @date_for_zodiac = dob_attribute
29
30
  @zodiac_sign_id_field = options[:sign_id_attribute]
30
31
 
@@ -35,7 +36,7 @@ module Zodiac
35
36
  object.send(:update_sign_id)
36
37
  end
37
38
 
38
- # Person.by_zodiac(7 || :libra) == Person.where(:zodiac_sign_id => 7)
39
+ # Person.by_zodiac(7 || :libra) == Person.where(zodiac_sign_id: 7)
39
40
  scope :by_zodiac, lambda { |sign|
40
41
  case sign
41
42
  when Symbol
@@ -49,7 +50,7 @@ module Zodiac
49
50
 
50
51
  # Person.gemini == Person.by_zodiac(3)
51
52
  Zodiac.each_sign do |symbol, integer|
52
- scope symbol, by_zodiac(integer)
53
+ scope symbol, -> { by_zodiac(integer) }
53
54
  end
54
55
  end
55
56
  end
data/lib/zodiac/date.rb CHANGED
@@ -2,12 +2,14 @@ module Zodiac
2
2
  module Date
3
3
  def zodiac_sign
4
4
  raise "#{self} should respond_to #month and #day" unless respond_to?(:month) && respond_to?(:day)
5
- Finder.sign_for(:month => self.month, :day => self.day)
5
+
6
+ Finder.sign_for(month: self.month, day: self.day)
6
7
  end
7
8
 
8
9
  def zodiac_sign_id
9
10
  raise "#{self} should respond_to #month and #day" unless respond_to?(:month) && respond_to?(:day)
10
- Finder.sign_id_for(:month => self.month, :day => self.day)
11
+
12
+ Finder.sign_id_for(month: self.month, day: self.day)
11
13
  end
12
14
 
13
15
  Zodiac.each_sign do |symbol, integer|
data/lib/zodiac/finder.rb CHANGED
@@ -54,7 +54,7 @@ module Zodiac
54
54
  private
55
55
  def self.sign_symbol_for(date)
56
56
  RANGES.each do |range, sign|
57
- if range.days.include? date_for(date[:month], date[:day])
57
+ if range.days.cover? date_for(date[:month], date[:day])
58
58
  return sign
59
59
  end
60
60
  end
@@ -1,3 +1,3 @@
1
1
  module Zodiac
2
- VERSION = '0.2.5'
2
+ VERSION = '0.2.6'
3
3
  end
data/zodiac.gemspec CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.add_dependency 'funtimes'
16
16
  s.add_dependency 'i18n'
17
+
17
18
  s.add_development_dependency 'rake'
18
19
  s.add_development_dependency 'rspec'
19
20
  s.add_development_dependency 'activerecord', '~> 3'
metadata CHANGED
@@ -1,84 +1,74 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zodiac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
5
- prerelease:
4
+ version: 0.2.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - Vsevolod Romashov
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-10-27 00:00:00.000000000 Z
11
+ date: 2013-11-14 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: funtimes
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: i18n
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: activerecord
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ~>
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ~>
92
81
  - !ruby/object:Gem::Version
@@ -94,49 +83,43 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: sqlite3
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: pry
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - '>='
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: awesome_print
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - '>='
132
116
  - !ruby/object:Gem::Version
133
117
  version: '0'
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - '>='
140
123
  - !ruby/object:Gem::Version
141
124
  version: '0'
142
125
  description: Adds methods for getting a zodiac sign from any Date/Time object containing
@@ -180,27 +163,26 @@ files:
180
163
  - zodiac.gemspec
181
164
  homepage: http://7even.github.com/zodiac
182
165
  licenses: []
166
+ metadata: {}
183
167
  post_install_message:
184
168
  rdoc_options: []
185
169
  require_paths:
186
170
  - lib
187
171
  required_ruby_version: !ruby/object:Gem::Requirement
188
- none: false
189
172
  requirements:
190
- - - ! '>='
173
+ - - '>='
191
174
  - !ruby/object:Gem::Version
192
175
  version: '0'
193
176
  required_rubygems_version: !ruby/object:Gem::Requirement
194
- none: false
195
177
  requirements:
196
- - - ! '>='
178
+ - - '>='
197
179
  - !ruby/object:Gem::Version
198
180
  version: '0'
199
181
  requirements: []
200
182
  rubyforge_project:
201
- rubygems_version: 1.8.23
183
+ rubygems_version: 2.0.3
202
184
  signing_key:
203
- specification_version: 3
185
+ specification_version: 4
204
186
  summary: Zodiac sign calculator for any date
205
187
  test_files:
206
188
  - spec/spec_helper.rb
@@ -211,4 +193,3 @@ test_files:
211
193
  - spec/zodiac/activerecord_spec.rb
212
194
  - spec/zodiac/date_spec.rb
213
195
  - spec/zodiac/finder_spec.rb
214
- has_rdoc: