rrule 0.0.0 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -0
  3. data/.travis.yml +3 -0
  4. data/CHANGELOG.md +7 -0
  5. data/CONTRIBUTING.md +17 -0
  6. data/Gemfile +5 -0
  7. data/LICENSE.txt +202 -0
  8. data/README.md +71 -0
  9. data/Rakefile +30 -0
  10. data/lib/rrule.rb +26 -4
  11. data/lib/rrule/context.rb +137 -0
  12. data/lib/rrule/filters/by_month.rb +16 -0
  13. data/lib/rrule/filters/by_month_day.rb +16 -0
  14. data/lib/rrule/filters/by_week_day.rb +24 -0
  15. data/lib/rrule/filters/by_week_number.rb +16 -0
  16. data/lib/rrule/filters/by_year_day.rb +18 -0
  17. data/lib/rrule/frequencies/daily.rb +13 -0
  18. data/lib/rrule/frequencies/frequency.rb +34 -0
  19. data/lib/rrule/frequencies/monthly.rb +14 -0
  20. data/lib/rrule/frequencies/weekly.rb +29 -0
  21. data/lib/rrule/frequencies/yearly.rb +14 -0
  22. data/lib/rrule/generators/all_occurrences.rb +26 -0
  23. data/lib/rrule/generators/by_set_position.rb +35 -0
  24. data/lib/rrule/rule.rb +181 -0
  25. data/lib/rrule/weekday.rb +17 -0
  26. data/rrule.gemspec +20 -0
  27. data/spec/context_spec.rb +261 -0
  28. data/spec/filters/by_month_day_spec.rb +35 -0
  29. data/spec/filters/by_month_spec.rb +35 -0
  30. data/spec/filters/by_week_day_spec.rb +35 -0
  31. data/spec/filters/by_week_number_spec.rb +41 -0
  32. data/spec/filters/by_year_day_spec.rb +35 -0
  33. data/spec/frequencies/daily_spec.rb +55 -0
  34. data/spec/frequencies/monthly_spec.rb +57 -0
  35. data/spec/frequencies/weekly_spec.rb +57 -0
  36. data/spec/frequencies/yearly_spec.rb +52 -0
  37. data/spec/generators/all_occurrences_spec.rb +44 -0
  38. data/spec/generators/by_set_position_spec.rb +39 -0
  39. data/spec/rule_spec.rb +1988 -0
  40. data/spec/spec_helper.rb +21 -0
  41. data/spec/weekday_spec.rb +34 -0
  42. metadata +88 -8
@@ -0,0 +1,21 @@
1
+ require 'rrule'
2
+
3
+ RSpec.configure do |config|
4
+ config.expect_with :rspec do |expectations|
5
+ # This option will default to `true` in RSpec 4. It makes the `description`
6
+ # and `failure_message` of custom matchers include text for helper methods
7
+ # defined using `chain`, e.g.:
8
+ # be_bigger_than(2).and_smaller_than(4).description
9
+ # # => "be bigger than 2 and smaller than 4"
10
+ # ...rather than:
11
+ # # => "be bigger than 2"
12
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
13
+ end
14
+
15
+ config.mock_with :rspec do |mocks|
16
+ # Prevents you from mocking or stubbing a method that does not exist on
17
+ # a real object. This is generally recommended, and will default to
18
+ # `true` in RSpec 4.
19
+ mocks.verify_partial_doubles = true
20
+ end
21
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ describe RRule::Weekday do
4
+ describe '.parse' do
5
+ subject(:weekday) { described_class.parse(weekday_string) }
6
+
7
+ context 'with an explicit + for the ordinal' do
8
+ let(:weekday_string) { '+2SU' }
9
+
10
+ it 'parses correctly' do
11
+ expect(weekday.ordinal).to eql 2
12
+ expect(weekday.index).to eql 0
13
+ end
14
+ end
15
+
16
+ context 'with an implied + for the ordinal' do
17
+ let(:weekday_string) { '2SU' }
18
+
19
+ it 'parses correctly' do
20
+ expect(weekday.ordinal).to eql 2
21
+ expect(weekday.index).to eql 0
22
+ end
23
+ end
24
+
25
+ context 'with a negative ordinal' do
26
+ let(:weekday_string) { '-3TU' }
27
+
28
+ it 'parses correctly' do
29
+ expect(weekday.ordinal).to eql -3
30
+ expect(weekday.index).to eql 2
31
+ end
32
+ end
33
+ end
34
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rrule
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Mitchell
@@ -9,17 +9,83 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2016-06-06 00:00:00.000000000 Z
12
- dependencies: []
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '4.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '4.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.4'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.4'
13
41
  description: A gem for expanding dates according to the RRule specification
14
42
  email: rmitchell@squareup.com
15
43
  executables: []
16
44
  extensions: []
17
45
  extra_rdoc_files: []
18
46
  files:
47
+ - ".gitignore"
48
+ - ".travis.yml"
49
+ - CHANGELOG.md
50
+ - CONTRIBUTING.md
51
+ - Gemfile
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
19
55
  - lib/rrule.rb
56
+ - lib/rrule/context.rb
57
+ - lib/rrule/filters/by_month.rb
58
+ - lib/rrule/filters/by_month_day.rb
59
+ - lib/rrule/filters/by_week_day.rb
60
+ - lib/rrule/filters/by_week_number.rb
61
+ - lib/rrule/filters/by_year_day.rb
62
+ - lib/rrule/frequencies/daily.rb
63
+ - lib/rrule/frequencies/frequency.rb
64
+ - lib/rrule/frequencies/monthly.rb
65
+ - lib/rrule/frequencies/weekly.rb
66
+ - lib/rrule/frequencies/yearly.rb
67
+ - lib/rrule/generators/all_occurrences.rb
68
+ - lib/rrule/generators/by_set_position.rb
69
+ - lib/rrule/rule.rb
70
+ - lib/rrule/weekday.rb
71
+ - rrule.gemspec
72
+ - spec/context_spec.rb
73
+ - spec/filters/by_month_day_spec.rb
74
+ - spec/filters/by_month_spec.rb
75
+ - spec/filters/by_week_day_spec.rb
76
+ - spec/filters/by_week_number_spec.rb
77
+ - spec/filters/by_year_day_spec.rb
78
+ - spec/frequencies/daily_spec.rb
79
+ - spec/frequencies/monthly_spec.rb
80
+ - spec/frequencies/weekly_spec.rb
81
+ - spec/frequencies/yearly_spec.rb
82
+ - spec/generators/all_occurrences_spec.rb
83
+ - spec/generators/by_set_position_spec.rb
84
+ - spec/rule_spec.rb
85
+ - spec/spec_helper.rb
86
+ - spec/weekday_spec.rb
20
87
  homepage: http://rubygems.org/gems/rrule
21
- licenses:
22
- - MIT
88
+ licenses: []
23
89
  metadata: {}
24
90
  post_install_message:
25
91
  rdoc_options: []
@@ -29,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
29
95
  requirements:
30
96
  - - ">="
31
97
  - !ruby/object:Gem::Version
32
- version: '0'
98
+ version: 1.9.2
33
99
  required_rubygems_version: !ruby/object:Gem::Requirement
34
100
  requirements:
35
101
  - - ">="
@@ -37,9 +103,23 @@ required_rubygems_version: !ruby/object:Gem::Requirement
37
103
  version: '0'
38
104
  requirements: []
39
105
  rubyforge_project:
40
- rubygems_version: 2.4.8
106
+ rubygems_version: 2.6.11
41
107
  signing_key:
42
108
  specification_version: 4
43
109
  summary: RRule expansion
44
- test_files: []
45
- has_rdoc:
110
+ test_files:
111
+ - spec/context_spec.rb
112
+ - spec/filters/by_month_day_spec.rb
113
+ - spec/filters/by_month_spec.rb
114
+ - spec/filters/by_week_day_spec.rb
115
+ - spec/filters/by_week_number_spec.rb
116
+ - spec/filters/by_year_day_spec.rb
117
+ - spec/frequencies/daily_spec.rb
118
+ - spec/frequencies/monthly_spec.rb
119
+ - spec/frequencies/weekly_spec.rb
120
+ - spec/frequencies/yearly_spec.rb
121
+ - spec/generators/all_occurrences_spec.rb
122
+ - spec/generators/by_set_position_spec.rb
123
+ - spec/rule_spec.rb
124
+ - spec/spec_helper.rb
125
+ - spec/weekday_spec.rb