periodical 0.1.1 → 0.2.0

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: 1fec77aa23c72fb853689f5157e26f7f99e1d9cc
4
+ data.tar.gz: 9121f8a1b764ca0800904cee8fabc878298df225
5
+ SHA512:
6
+ metadata.gz: d4a1cfc15f47f1c6f6db749bd988ae65d2bd88927e7af67e5588787765ab64f99f28add125f8cadd1ff4dac1bc9961137023098d1f0824389d1f40dfb6068f15
7
+ data.tar.gz: 5a3035e609a4abb6613ac897a282d088b3eaa571c671ab227e722c4eb85d46b2dbc88055797f82b79cfcf4ac39da7f316a5e3a6037b36f314b6f47b3a30bf56a
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - "2.0"
4
+ - "2.1"
5
+ matrix:
6
+ allow_failures:
7
+ - rvm: "1.9"
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in periodical.gemspec
4
+ gemspec
data/README.md CHANGED
@@ -1,14 +1,22 @@
1
- Periodical
2
- =========
3
-
4
- * Author: Samuel G. D. Williams (<http://www.oriontransfer.co.nz>)
5
- * Copyright (C) 2012 Samuel G. D. Williams.
6
- * Released under the MIT license.
1
+ # Periodical
7
2
 
8
3
  Periodical is a simple framework for working with durations and periods. A duration measures a range of time bounded by a `from` date and `to` date. A period is a relative unit of time such as `4 weeks`.
9
4
 
10
- Basic Usage
11
- -----------
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'periodical'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install periodical
18
+
19
+ ## Usage
12
20
 
13
21
  The main use case for this framework involves periodic billing or accounting (e.g. calculating fortnightly rental payments).
14
22
 
@@ -21,10 +29,19 @@ The main use case for this framework involves periodic billing or accounting (e.
21
29
  # Calculate the date which is 2 * (2 weeks)
22
30
  next = period.advance(duration.from, 2)
23
31
 
24
- License
25
- -------
32
+ ## Contributing
33
+
34
+ 1. Fork it
35
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
36
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
37
+ 4. Push to the branch (`git push origin my-new-feature`)
38
+ 5. Create new Pull Request
39
+
40
+ ## License
41
+
42
+ Released under the MIT license.
26
43
 
27
- Copyright (c) 2010, 2011 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
44
+ Copyright, 2010, 2014, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
28
45
 
29
46
  Permission is hereby granted, free of charge, to any person obtaining a copy
30
47
  of this software and associated documentation files (the "Software"), to deal
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,128 @@
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require 'date'
22
+
23
+ module Periodical
24
+ # A filter module for backup rotation like behaviour, e.g. keep every hour for 24 hours, every day for 30 days, etc.
25
+ module Filter
26
+ # Keep count sorted objects per period.
27
+ class Period
28
+ KeepOldest = Proc.new do |t1, t2|
29
+ t1 > t2
30
+ end
31
+
32
+ KeepYoungest = Proc.new do |t1, t2|
33
+ t1 < t2
34
+ end
35
+
36
+ def initialize(count)
37
+ @count = count
38
+ end
39
+
40
+ def filter(values, options = {})
41
+ slots = {}
42
+
43
+ keep = (options[:keep] == :youngest) ? KeepYoungest : KeepOldest
44
+
45
+ values.each do |value|
46
+ k = key(value)
47
+
48
+ # We want to keep the newest backup if possible (<).
49
+ next if slots.key?(k) and keep.call(value, slots[k])
50
+
51
+ slots[k] = value
52
+ end
53
+
54
+ sorted_values = slots.values.sort
55
+
56
+ return sorted_values[0...@count]
57
+ end
58
+
59
+ def key(t)
60
+ raise ArgumentError
61
+ end
62
+
63
+ def mktime(year, month=1, day=1, hour=0, minute=0, second=0)
64
+ return Time.new(year, month, day, hour, minute, second)
65
+ end
66
+
67
+ attr :count
68
+ end
69
+
70
+ class Hourly < Period
71
+ def key(t)
72
+ mktime(t.year, t.month, t.day, t.hour)
73
+ end
74
+ end
75
+
76
+ class Daily < Period
77
+ def key(t)
78
+ mktime(t.year, t.month, t.day)
79
+ end
80
+ end
81
+
82
+ class Weekly < Period
83
+ def key(t)
84
+ mktime(t.year, t.month, t.day) - (t.wday * 3600 * 24)
85
+ end
86
+ end
87
+
88
+ class Monthly < Period
89
+ def key(t)
90
+ mktime(t.year, t.month)
91
+ end
92
+ end
93
+
94
+ class Quarterly < Period
95
+ def key(t)
96
+ mktime(t.year, (t.month - 1) / 3 * 3 + 1)
97
+ end
98
+ end
99
+
100
+ class Yearly < Period
101
+ def key(t)
102
+ mktime(t.year)
103
+ end
104
+ end
105
+
106
+ class Policy
107
+ def initialize
108
+ @periods = {}
109
+ end
110
+
111
+ def <<(period)
112
+ @periods[period.class] = period
113
+ end
114
+
115
+ def filter(values, options = {})
116
+ filtered_values = Set.new
117
+
118
+ @periods.values.each do |period|
119
+ filtered_values += period.filter(values, options)
120
+ end
121
+
122
+ return filtered_values, (Set.new(values) - filtered_values)
123
+ end
124
+
125
+ attr :periods
126
+ end
127
+ end
128
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the "Software"), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the "Software"), to deal
@@ -19,11 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Periodical
22
- module VERSION
23
- MAJOR = 0
24
- MINOR = 1
25
- TINY = 1
26
-
27
- STRING = [MAJOR, MINOR, TINY].join('.')
28
- end
22
+ VERSION = "0.2.0"
29
23
  end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'periodical/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "periodical"
8
+ spec.version = Periodical::VERSION
9
+ spec.authors = ["Samuel Williams"]
10
+ spec.email = ["samuel.williams@oriontransfer.co.nz"]
11
+ spec.summary = %q{Periodical is a simple framework for working with durations and periods.}
12
+ spec.license = "MIT"
13
+
14
+ spec.files = `git ls-files`.split($/)
15
+ spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.required_ruby_version = '>= 2.0'
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rspec", "~> 3.0.0"
23
+ spec.add_development_dependency "rake"
24
+ end
@@ -0,0 +1,50 @@
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require 'periodical'
22
+
23
+ module Periodical::DurationSpec
24
+ describe Periodical::Duration do
25
+ it "should measure durations correctly" do
26
+ duration = Periodical::Duration.new(Date.parse("2010-01-01"), Date.parse("2010-02-01"))
27
+ expect(duration.days).to be == 31
28
+ expect(duration.weeks).to be == Rational(31, 7)
29
+ expect(duration.months).to be == 1
30
+ expect(duration.years).to be == Rational(31, 365)
31
+
32
+ expect(duration.whole_months).to be == 1
33
+ expect(duration.whole_years).to be == 0
34
+ end
35
+
36
+ it "should compute the correct number of weeks" do
37
+ duration = Periodical::Duration.new(Date.parse("2010-01-01"), Date.parse("2010-02-01"))
38
+ period = Periodical::Period.new(2, :weeks)
39
+
40
+ expect(duration / period).to be == Rational(31, 14)
41
+ end
42
+
43
+ it "should compute the correct number of months" do
44
+ duration = Periodical::Duration.new(Date.parse("2010-01-01"), Date.parse("2011-03-01"))
45
+ period = Periodical::Period.new(2, :months)
46
+
47
+ expect(duration / period).to be == Rational(14, 2)
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,63 @@
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require 'periodical/filter'
22
+
23
+ module Periodical::PeriodSpec
24
+ describe Periodical::Filter do
25
+ it "should select at most 3 days worth of data" do
26
+ dates = [
27
+ Date.parse("2010-01-01"),
28
+ Date.parse("2010-01-02"),
29
+ Date.parse("2010-01-03"),
30
+ Date.parse("2010-01-04"),
31
+ Date.parse("2010-01-05"),
32
+ Date.parse("2010-01-06"),
33
+ ]
34
+
35
+ policy = Periodical::Filter::Policy.new
36
+ policy << Periodical::Filter::Daily.new(3)
37
+
38
+ selected, rejected = policy.filter(dates)
39
+ expect(selected.count).to be 3
40
+ expect(rejected.count).to be 3
41
+
42
+ # Keep oldest is the default policy
43
+ expect(selected).to be_include(dates[0])
44
+ end
45
+
46
+ it "should keep youngest" do
47
+ dates = [
48
+ Date.parse("2010-01-01"),
49
+ Date.parse("2010-01-02"),
50
+ ]
51
+
52
+ policy = Periodical::Filter::Policy.new
53
+ policy << Periodical::Filter::Monthly.new(1)
54
+
55
+ selected, rejected = policy.filter(dates, :keep => :youngest)
56
+ expect(selected.count).to be 1
57
+ expect(rejected.count).to be 1
58
+
59
+ # Keep oldest is the default policy
60
+ expect(selected).to be_include(dates[1])
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,33 @@
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require 'periodical'
22
+
23
+ module Periodical::PeriodSpec
24
+ describe Periodical::Period do
25
+ it "should advance by 1 month" do
26
+ duration = Periodical::Duration.new(Date.parse("2010-01-01"), Date.parse("2011-01-01"))
27
+
28
+ period = Periodical::Period.new(1, :months)
29
+
30
+ expect(period.advance(duration.from, 12)).to be == duration.to
31
+ end
32
+ end
33
+ end
metadata CHANGED
@@ -1,53 +1,102 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: periodical
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Samuel Williams
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-07-26 00:00:00.000000000 Z
13
- dependencies: []
11
+ date: 2014-06-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
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.0.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 3.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
14
55
  description:
15
- email: samuel.williams@oriontransfer.co.nz
56
+ email:
57
+ - samuel.williams@oriontransfer.co.nz
16
58
  executables: []
17
59
  extensions: []
18
60
  extra_rdoc_files: []
19
61
  files:
62
+ - ".travis.yml"
63
+ - Gemfile
64
+ - README.md
65
+ - Rakefile
66
+ - lib/periodical.rb
20
67
  - lib/periodical/duration.rb
68
+ - lib/periodical/filter.rb
21
69
  - lib/periodical/period.rb
22
70
  - lib/periodical/version.rb
23
- - lib/periodical.rb
24
- - test/helper.rb
25
- - test/test_duration.rb
26
- - test/test_period.rb
27
- - README.md
28
- homepage: http://www.oriontransfer.co.nz/
29
- licenses: []
71
+ - periodical.gemspec
72
+ - spec/periodical/duration_spec.rb
73
+ - spec/periodical/filter_spec.rb
74
+ - spec/periodical/period_spec.rb
75
+ homepage:
76
+ licenses:
77
+ - MIT
78
+ metadata: {}
30
79
  post_install_message:
31
80
  rdoc_options: []
32
81
  require_paths:
33
82
  - lib
34
83
  required_ruby_version: !ruby/object:Gem::Requirement
35
- none: false
36
84
  requirements:
37
- - - ! '>='
85
+ - - ">="
38
86
  - !ruby/object:Gem::Version
39
- version: '0'
87
+ version: '2.0'
40
88
  required_rubygems_version: !ruby/object:Gem::Requirement
41
- none: false
42
89
  requirements:
43
- - - ! '>='
90
+ - - ">="
44
91
  - !ruby/object:Gem::Version
45
92
  version: '0'
46
93
  requirements: []
47
94
  rubyforge_project:
48
- rubygems_version: 1.8.23
95
+ rubygems_version: 2.2.2
49
96
  signing_key:
50
- specification_version: 3
97
+ specification_version: 4
51
98
  summary: Periodical is a simple framework for working with durations and periods.
52
- test_files: []
53
- has_rdoc:
99
+ test_files:
100
+ - spec/periodical/duration_spec.rb
101
+ - spec/periodical/filter_spec.rb
102
+ - spec/periodical/period_spec.rb
data/test/helper.rb DELETED
@@ -1,4 +0,0 @@
1
-
2
- $LOAD_PATH.unshift File.expand_path("../../lib/", __FILE__)
3
-
4
- require 'test/unit'
@@ -1,34 +0,0 @@
1
-
2
- require 'helper'
3
-
4
- require 'periodical'
5
-
6
- class DurationTest < Test::Unit::TestCase
7
- def setup
8
- end
9
-
10
- def test_duration
11
- duration = Periodical::Duration.new(Date.parse("2010-01-01"), Date.parse("2010-02-01"))
12
- assert_equal 31, duration.days
13
- assert_equal Rational(31, 7), duration.weeks
14
- assert_equal 1, duration.months
15
- assert_equal Rational(31, 365), duration.years
16
-
17
- assert_equal 1, duration.whole_months
18
- assert_equal 0, duration.whole_years
19
- end
20
-
21
- def test_weekly_period
22
- duration = Periodical::Duration.new(Date.parse("2010-01-01"), Date.parse("2010-02-01"))
23
- period = Periodical::Period.new(2, :weeks)
24
-
25
- assert_equal Rational(31, 14), duration / period
26
- end
27
-
28
- def test_monthly_period
29
- duration = Periodical::Duration.new(Date.parse("2010-01-01"), Date.parse("2011-03-01"))
30
- period = Periodical::Period.new(2, :months)
31
-
32
- assert_equal Rational(14, 2), duration / period
33
- end
34
- end
data/test/test_period.rb DELETED
@@ -1,15 +0,0 @@
1
-
2
- require 'helper'
3
-
4
- require 'periodical'
5
-
6
- class PeriodTest < Test::Unit::TestCase
7
- def setup
8
- end
9
-
10
- def test_advance
11
- duration = Periodical::Duration.new(Date.parse("2010-01-01"), Date.parse("2011-01-01"))
12
- period = Periodical::Period.new(1, :months)
13
- assert_equal duration.to, period.advance(duration.from, 12)
14
- end
15
- end