recurrence 1.2.0 → 1.3.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.
@@ -1,3 +1,4 @@
1
+ require "bundler/setup"
1
2
  require "rspec"
2
3
  require "recurrence"
3
4
 
metadata CHANGED
@@ -1,60 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recurrence
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
5
- prerelease:
4
+ version: 1.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Nando Vieira
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2011-08-06 00:00:00.000000000 Z
11
+ date: 2014-04-21 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activesupport
16
- requirement: &70272129285780 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
- version: 2.3.0
19
+ version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *70272129285780
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: i18n
27
- requirement: &70272129283720 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - ">="
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *70272129283720
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: rspec
38
- requirement: &70272129280220 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
- - - ~>
45
+ - - '='
42
46
  - !ruby/object:Gem::Version
43
- version: '2.6'
47
+ version: 3.0.0.beta2
44
48
  type: :development
45
49
  prerelease: false
46
- version_requirements: *70272129280220
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 3.0.0.beta2
47
55
  - !ruby/object:Gem::Dependency
48
56
  name: rake
49
- requirement: &70272129277740 !ruby/object:Gem::Requirement
50
- none: false
57
+ requirement: !ruby/object:Gem::Requirement
51
58
  requirements:
52
- - - ~>
59
+ - - ">="
53
60
  - !ruby/object:Gem::Version
54
- version: '0.9'
61
+ version: '0'
55
62
  type: :development
56
63
  prerelease: false
57
- version_requirements: *70272129277740
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
58
69
  description: A simple library to handle recurring events
59
70
  email:
60
71
  - fnando.vieira@gmail.com
@@ -62,14 +73,13 @@ executables: []
62
73
  extensions: []
63
74
  extra_rdoc_files: []
64
75
  files:
65
- - .gitignore
66
- - .rspec
67
- - .rvmrc
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
68
79
  - Gemfile
69
80
  - Gemfile.lock
70
- - History.txt
71
81
  - License.txt
72
- - README.rdoc
82
+ - README.md
73
83
  - Rakefile
74
84
  - lib/recurrence.rb
75
85
  - lib/recurrence/event.rb
@@ -87,33 +97,26 @@ files:
87
97
  - spec/spec_helper.rb
88
98
  homepage: http://rubygems.org/gems/recurrence
89
99
  licenses: []
100
+ metadata: {}
90
101
  post_install_message:
91
102
  rdoc_options: []
92
103
  require_paths:
93
104
  - lib
94
105
  required_ruby_version: !ruby/object:Gem::Requirement
95
- none: false
96
106
  requirements:
97
- - - ! '>='
107
+ - - ">="
98
108
  - !ruby/object:Gem::Version
99
109
  version: '0'
100
- segments:
101
- - 0
102
- hash: 4417332307528947128
103
110
  required_rubygems_version: !ruby/object:Gem::Requirement
104
- none: false
105
111
  requirements:
106
- - - ! '>='
112
+ - - ">="
107
113
  - !ruby/object:Gem::Version
108
114
  version: '0'
109
- segments:
110
- - 0
111
- hash: 4417332307528947128
112
115
  requirements: []
113
116
  rubyforge_project:
114
- rubygems_version: 1.8.6
117
+ rubygems_version: 2.2.2
115
118
  signing_key:
116
- specification_version: 3
119
+ specification_version: 4
117
120
  summary: A simple library to handle recurring events
118
121
  test_files:
119
122
  - spec/recurrence_spec.rb
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm 1.9.2@base
@@ -1,83 +0,0 @@
1
- == 0.0.1 2008-09-21
2
-
3
- * Initial release
4
-
5
- == 0.0.2 2008-09-21
6
-
7
- * Added `items` and `items!` methods; returns an array with all events
8
-
9
- == 0.0.3 2008-09-22
10
-
11
- * The recurrence now considers the starting date and its configurations
12
- * Added lots of specs
13
-
14
- == 0.0.4 2008-09-30
15
-
16
- * Renamed items method to events
17
- * Added each! method
18
- * Added lots of specs
19
-
20
- == 0.0.5 2008-09-30
21
-
22
- * Monthly interval now accepts symbols: monthly, bimonthly, quarterly, semesterly
23
-
24
- == 0.0.6 2009-01-06
25
-
26
- * Code refactoring
27
- * Added next and next! methods
28
- * Added more specs
29
- * Yearly interval now accepts symbols: jan-dec and january-december
30
-
31
- == 0.0.7 2009-01-06
32
-
33
- * The events method now accepts :starts and :until dates
34
-
35
- == 0.0.8 2009-01-07
36
-
37
- * The iteration is stopped when the :until is reached when limiting events
38
-
39
- == 0.1.0 2009-07-18
40
-
41
- * Allow monthly recurrences to occur by weekday:
42
- Recurrence.new(:every => :month, :on => :first, :weekday => :thursday)
43
- * Allow several weekdays to be given to weekly recurrence:
44
- Recurrence.new(:every => :week, :on => [:monday, :wednesday, :friday])
45
- * Added :daily, :weekly, :monthly and :yearly shortcuts to Recurrence.
46
-
47
- == 0.1.1 2009-12-18
48
-
49
- * Removed ActiveSupport deprecation; should require active_support instead.
50
-
51
- == 0.1.2 2010-09-09
52
-
53
- * Refactor, refactor, refactor.
54
- * Using Recurrence as Rails plugin is now deprecated; install it as a gem instead.
55
-
56
- == 0.1.3 2010-09-14
57
-
58
- * Moved Recurrence class to SimpleIdeias namespace; see troubleshooting section for instructions.
59
-
60
- == 0.1.4 2010-10-19
61
-
62
- * Bug fix: yearly recurrence was raising an error
63
-
64
- == 0.1.5 2010-11-03
65
-
66
- * Recurrence.default_starts_date is now configurable; pass in a String or block
67
- * Add Recurrence#options reader so we'll be able to use Recurrence with ActiveRecord.composed_of
68
-
69
- == 1.0.0 2010-11-16
70
-
71
- * Recurrence#each returns an enumerator when no block is given
72
- * Recurrence now includes Enumerable
73
- * The public API is now documented
74
- * Remove support for Rails plugin
75
-
76
- == 1.0.1 2010-11-19
77
-
78
- * Added :repeat option
79
- * Added support for weekday shortcut (sun..sat)
80
-
81
- == 1.0.2 2011-02-09
82
-
83
- * Added Ruby 1.8 support
@@ -1,136 +0,0 @@
1
- = Recurrence
2
-
3
- A simple library to handle recurring events.
4
-
5
- == Installation
6
-
7
- gem install recurrence
8
-
9
- == Usage
10
-
11
- require "rubygems"
12
- require "recurrence"
13
-
14
- # Daily
15
- r = Recurrence.new(:every => :day)
16
- r = Recurrence.new(:every => :day, :interval => 9)
17
- r = Recurrence.new(:every => :day, :repeat => 7)
18
- r = Recurrence.daily(options = {})
19
-
20
- # Weekly
21
- r = Recurrence.new(:every => :week, :on => 5)
22
- r = Recurrence.new(:every => :week, :on => :monday)
23
- r = Recurrence.new(:every => :week, :on => [:monday, :friday])
24
- r = Recurrence.new(:every => :week, :on => [:monday, :wednesday, :friday])
25
- r = Recurrence.new(:every => :week, :on => :friday, :interval => 2)
26
- r = Recurrence.new(:every => :week, :on => :friday, :repeat => 4)
27
- r = Recurrence.weekly(:on => :thursday)
28
-
29
- # Monthly by month day
30
- r = Recurrence.new(:every => :month, :on => 15)
31
- r = Recurrence.new(:every => :month, :on => 31)
32
- r = Recurrence.new(:every => :month, :on => 7, :interval => 2)
33
- r = Recurrence.new(:every => :month, :on => 7, :interval => :monthly)
34
- r = Recurrence.new(:every => :month, :on => 7, :interval => :bimonthly)
35
- r = Recurrence.new(:every => :month, :on => 7, :repeat => 6)
36
- r = Recurrence.monthly(:on => 31)
37
-
38
- # Monthly by week day
39
- r = Recurrence.new(:every => :month, :on => :first, :weekday => :sunday)
40
- r = Recurrence.new(:every => :month, :on => :third, :weekday => :monday)
41
- r = Recurrence.new(:every => :month, :on => :last, :weekday => :friday)
42
- r = Recurrence.new(:every => :month, :on => :last, :weekday => :friday, :interval => 2)
43
- r = Recurrence.new(:every => :month, :on => :last, :weekday => :friday, :interval => :quarterly)
44
- r = Recurrence.new(:every => :month, :on => :last, :weekday => :friday, :interval => :semesterly)
45
- r = Recurrence.new(:every => :month, :on => :last, :weekday => :friday, :repeat => 3)
46
-
47
- # Yearly
48
- r = Recurrence.new(:every => :year, :on => [7, 4]) # => [month, day]
49
- r = Recurrence.new(:every => :year, :on => [10, 31], :interval => 3)
50
- r = Recurrence.new(:every => :year, :on => [:jan, 31])
51
- r = Recurrence.new(:every => :year, :on => [:january, 31])
52
- r = Recurrence.new(:every => :year, :on => [10, 31], :repeat => 3)
53
- r = Recurrence.yearly(:on => [:january, 31])
54
-
55
- # Limit recurrence
56
- # :starts defaults to Date.today
57
- # :until defaults to 2037-12-31
58
- r = Recurrence.new(:every => :day, :starts => Date.today)
59
- r = Recurrence.new(:every => :day, :until => '2010-01-31')
60
- r = Recurrence.new(:every => :day, :starts => Date.today, :until => '2010-01-31')
61
-
62
- # Override the next date handler
63
- r = Recurrence.new(:every => :month, :on => 1, :handler => Proc.new { |day, month, year| raise("Date not allowed!") if year == 2011 && month == 12 && day == 31 })
64
-
65
- # Shift the recurrences to maintain dates around boundaries (Jan 31 -> Feb 28 -> Mar 28)
66
- r = Recurrence.new(:every => :month, :on => 31, :shift => true)
67
-
68
- # Getting an array with all events
69
- r.events.each {|date| puts date.to_s } # => Memoized array
70
- r.events!.each {|date| puts date.to_s } # => reset items cache and re-execute it
71
- r.events(:starts => '2009-01-01').each {|date| puts date.to_s }
72
- r.events(:until => '2009-01-10').each {|date| puts date.to_s }
73
- r.events(:starts => '2009-01-05', :until => '2009-01-10').each {|date| puts date.to_s }
74
-
75
- # Iterating events
76
- r.each { |date| puts date.to_s } # => Use items method
77
- r.each! { |date| puts date.to_s } # => Use items! method
78
-
79
- # Check if a date is included
80
- r.include?(Date.today) # => true or false
81
- r.include?('2008-09-21')
82
-
83
- # Get next available date
84
- r.next # => Keep the original date object
85
- r.next! # => Change the internal date object to the next available date
86
-
87
- == Troubleshooting
88
-
89
- If you're having problems because already have a class/module called Recurrence that is conflicting with this gem, you can require the namespace and create a class that inherits from <tt>SimplesIdeias::Recurrence</tt>.
90
-
91
- require "recurrence/namespace"
92
-
93
- class RecurrentEvent < SimplesIdeias::Recurrence
94
- end
95
-
96
- r = RecurrentEvent.new(:every => :day)
97
-
98
- If you're using Rails/Bundler or something like that, remember to override the <tt>:require</tt> option.
99
-
100
- # Gemfile
101
- source :rubygems
102
-
103
- gem "recurrence", :require => "recurrence/namespace"
104
-
105
- == Maintainer
106
-
107
- * Nando Vieira (http://nandovieira.com.br)
108
-
109
- == Contributors
110
-
111
- * José Valim (http://plataformatec.com.br)
112
- * Maxim Chernyak (http://mediumexposure.com)
113
- * Ricardo H. (https://github.com/ricardohsd)
114
-
115
- == License
116
-
117
- (The MIT License)
118
-
119
- Permission is hereby granted, free of charge, to any person obtaining
120
- a copy of this software and associated documentation files (the
121
- 'Software'), to deal in the Software without restriction, including
122
- without limitation the rights to use, copy, modify, merge, publish,
123
- distribute, sublicense, and/or sell copies of the Software, and to
124
- permit persons to whom the Software is furnished to do so, subject to
125
- the following conditions:
126
-
127
- The above copyright notice and this permission notice shall be
128
- included in all copies or substantial portions of the Software.
129
-
130
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
131
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
132
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
133
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
134
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
135
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
136
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.