hiccup 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/README.mdown +73 -2
- data/hiccup.gemspec +2 -2
- data/lib/hiccup/enumerable.rb +2 -0
- data/lib/hiccup/schedule.rb +1 -1
- data/lib/hiccup/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76c7bd6b71cf03ea4f9897a640bb377c9b99fbcd
|
4
|
+
data.tar.gz: 5d8d072d237f71ce14cc1e31da9ba3bb6917a854
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89735aa481b1b83673566f0aebc0454c8a391a0f385db052d6ca727ce731247b897318ff1df39ad0d6b6d9e98f0c7953bfe1076a8ded0aa54c459556dba099b5
|
7
|
+
data.tar.gz: 5867b146eaecda8e888c3399cf7f46e63d163e5acfe09f63696d6856ef775cf3690e4da4f77f92dbbe75ade0a2e102e1aaac9968a2df0f5541ef2045fb89cd5c
|
data/.travis.yml
ADDED
data/README.mdown
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
# Hiccup
|
2
2
|
|
3
|
-
|
3
|
+
[![Build Status](https://travis-ci.org/boblail/hiccup.png?branch=master)](https://travis-ci.org/boblail/hiccup)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/boblail/hiccup.png)](https://codeclimate.com/github/boblail/hiccup)
|
4
5
|
|
5
|
-
Hiccup
|
6
|
+
Hiccup mixes a-la-cart recurrence features into your recurring model. It doesn't dictate the data structure of your model, just the interface. It works like Devise does for authenticatable models.
|
7
|
+
|
8
|
+
Hiccup does provide a lightweight `Schedule` class that mixes in all of Hiccup's feature, but you don't have to use Hiccup's Schedule if you don't want to.
|
6
9
|
|
7
10
|
### Usage
|
8
11
|
|
@@ -52,14 +55,57 @@ Schedule.new(:kind => :monthly, :monthly_pattern => [[2, "Sunday"], [4, "Sunday"
|
|
52
55
|
|
53
56
|
Supplies methods for creating instances of a recurring pattern
|
54
57
|
|
58
|
+
Examples
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
schedule = Schedule.new(
|
62
|
+
:kind => :weekly,
|
63
|
+
:weekly_pattern => %w{Monday Wednesday Friday},
|
64
|
+
:start_date => Date.new(2009, 3, 15))
|
65
|
+
|
66
|
+
# includes?
|
67
|
+
schedule.includes? Date.new(2009, 5, 20) # => true
|
68
|
+
schedule.includes? Date.new(2009, 3, 15) # => false (3/15/09 is a Sunday)
|
69
|
+
|
70
|
+
# occurrences_between
|
71
|
+
schedule.occurrences_between(
|
72
|
+
Date.new(2009, 3, 26),
|
73
|
+
Date.new(2009, 3, 31)) #=> [Fri, 27 Mar 2009, Mon, 30 Mar 2009]
|
74
|
+
|
75
|
+
# n_occurrences_before
|
76
|
+
schedule.n_occurrences_before(3, Date.new(2009, 3, 31)) # => [Mon, 30 Mar 2009, Fri, 27 Mar 2009, Wed, 25 Mar 2009]
|
77
|
+
```
|
78
|
+
|
79
|
+
|
80
|
+
|
55
81
|
### Validatable
|
56
82
|
|
57
83
|
Mixes in ActiveModel validations for recurrence models
|
58
84
|
|
85
|
+
|
86
|
+
|
59
87
|
### Humanizable
|
60
88
|
|
61
89
|
Represents a recurring pattern in a human-readable string
|
62
90
|
|
91
|
+
Examples:
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
# A monthly recurrence
|
95
|
+
schedule = Schedule.new(:kind => :monthly, :monthly_pattern => [[-1, "Tuesday"]])
|
96
|
+
schedule.humanize # => "The last Tuesday of every month"
|
97
|
+
|
98
|
+
# With skips
|
99
|
+
schedule = Schedule.new(:kind => :weekly, :weekly_pattern => %w[Sunday], :skip => 2)
|
100
|
+
schedule.humanize # => "Every other Sunday"
|
101
|
+
|
102
|
+
# An anniversary
|
103
|
+
schedule = Schedule.new(:kind => :annually, start_date: Date.new(2012, 10, 1))
|
104
|
+
schedule.humanize # => "Every year on October 1"
|
105
|
+
```
|
106
|
+
|
107
|
+
|
108
|
+
|
63
109
|
### Inferable
|
64
110
|
|
65
111
|
Infers a schedule from an array of dates
|
@@ -77,6 +123,31 @@ schedule = Schedule.infer %w{2012-3-6 2012-3-8 2012-3-15 2012-3-20 2012-3-27 201
|
|
77
123
|
schedule.humanize # => "Every Tuesday and Thursday"
|
78
124
|
```
|
79
125
|
|
126
|
+
|
127
|
+
|
80
128
|
### Serializable
|
81
129
|
|
82
130
|
Supports serializing and deserializing a recurrence pattern to an array of formats
|
131
|
+
|
132
|
+
Examples:
|
133
|
+
|
134
|
+
```ruby
|
135
|
+
schedule = Schedule.from_ical <<-ICAL
|
136
|
+
DTSTART;VALUE=DATE-TIME:20090101T000000Z
|
137
|
+
RRULE:FREQ=WEEKLY;INTERVAL=2;BYDAY=TU,TH
|
138
|
+
ICAL
|
139
|
+
schedule.humanize # => "Tuesday and Thursday of every other week"
|
140
|
+
|
141
|
+
schedule = Schedule.new(
|
142
|
+
:kind => :weekly,
|
143
|
+
:weekly_pattern => %w{Tuesday Thursday},
|
144
|
+
:start_date => DateTime.new(2009, 1, 1),
|
145
|
+
:skip => 2)
|
146
|
+
schedule.to_ical # => "DTSTART;VALUE=DATE-TIME:20090101T000000Z\nRRULE:FREQ=WEEKLY;INTERVAL=2;BYDAY=TU,TH\n"
|
147
|
+
```
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
## License
|
152
|
+
|
153
|
+
Copyright (c) 2012 Bob Lail, released under the MIT license
|
data/hiccup.gemspec
CHANGED
@@ -13,11 +13,11 @@ Gem::Specification.new do |s|
|
|
13
13
|
|
14
14
|
s.rubyforge_project = "hiccup"
|
15
15
|
|
16
|
-
s.add_dependency "activesupport", "
|
16
|
+
s.add_dependency "activesupport", ">= 3.2.8"
|
17
17
|
s.add_dependency "builder"
|
18
18
|
|
19
19
|
s.add_development_dependency "ri_cal"
|
20
|
-
s.add_development_dependency "rails", "
|
20
|
+
s.add_development_dependency "rails", ">= 3.2.8"
|
21
21
|
s.add_development_dependency "turn"
|
22
22
|
s.add_development_dependency "simplecov"
|
23
23
|
s.add_development_dependency "shoulda-context"
|
data/lib/hiccup/enumerable.rb
CHANGED
data/lib/hiccup/schedule.rb
CHANGED
data/lib/hiccup/version.rb
CHANGED
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hiccup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Lail
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 3.2.8
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.2.8
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
name: rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 3.2.8
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 3.2.8
|
69
69
|
- !ruby/object:Gem::Dependency
|
@@ -132,6 +132,7 @@ extra_rdoc_files: []
|
|
132
132
|
files:
|
133
133
|
- .gitignore
|
134
134
|
- .simplecov
|
135
|
+
- .travis.yml
|
135
136
|
- Gemfile
|
136
137
|
- README.mdown
|
137
138
|
- Rakefile
|
@@ -192,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
193
|
version: '0'
|
193
194
|
requirements: []
|
194
195
|
rubyforge_project: hiccup
|
195
|
-
rubygems_version: 2.0.
|
196
|
+
rubygems_version: 2.0.14
|
196
197
|
signing_key:
|
197
198
|
specification_version: 4
|
198
199
|
summary: A library for working with things that recur
|