mcal 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6431415bca9b00eea97d3272c50291466242e4f5
4
- data.tar.gz: 03e3dbe6376ff6aa03a795a5a1ccd94d6946a126
3
+ metadata.gz: 8efcf8cae3164a471c5f59fa9a06407ab97aad8f
4
+ data.tar.gz: 84be2649055358de7233021f1787b325e99ad01c
5
5
  SHA512:
6
- metadata.gz: 13b10833c950f6ee6a3b9f7e722cfaa3c21feec8724fb2f943536b869ab67bd2f917a4897ed843fc1d4f8b19306f55244e7c2a10a10e379d2f4d889ddc260dff
7
- data.tar.gz: a9f62118b7c7d77e8c2805e79f90c0da3376591ef6f29f7a3a16b7a5e6dfc5f6019dc84a809caae0304e50ea09e5b6b35145fc10bf8c40e3421d8c81a8d053c2
6
+ metadata.gz: 17f8d582ec9d494ed1748412ba18338584aa8351fba81179ffdd3547a0fd139958fe322ca41a0b76612da34092806b0449caffd6168ce67c3ccfdf499869d52d
7
+ data.tar.gz: 028a79a7561c5b9533a453cdb3a942f80dabd434617af08aa130be6c677301ed872b5d289a7bbe4d649d7838e0812ed8837afca1925b5886bf923fbd4894e3df
data/README.md CHANGED
@@ -20,11 +20,31 @@ Or install it yourself as:
20
20
 
21
21
  It's a really simple library. You give it a year and a month, and it'll give you back a nested array of weeks in that month. It orders the days like a standard calendar; Sunday - Saturday.
22
22
 
23
- TODO
23
+ ```ruby
24
+ >>> calendar = Mcal::Calendar.new(2013)
25
+ >>> calendar.monthly(4)
26
+ [[nil, 1, 2, 3, 4, 5, 6],
27
+ [ 7, 8, 9, 10, 11, 12, 13],
28
+ [ 14, 15, 16, 17, 18, 19, 20],
29
+ [ 21, 22, 23, 24, 25, 26, 27],
30
+ [ 28, 29, 30, nil, nil, nil, nil]]
31
+ ```
32
+
33
+ `#monthly` also takes a block argument that receives the `Date` object in case you want to do something special:
24
34
 
25
35
  ```ruby
26
- calendar = Calendar.new(2013)
27
- calendar.monthly(2)
36
+ >>> calendar = Mcal::Calendar.new(2013)
37
+ >>> holidays = [
38
+ Date.new(2013, 12, 24),
39
+ Date.new(2013, 12, 25)
40
+ ]
41
+ dec = 12
42
+ >>> calendar.monthly(dec) { |d| holidays.include?(d) ? 'H' : d.mday }.must_equal [
43
+ [[ 1, 2, 3, 4, 5, 6, 7],
44
+ [ 8, 9, 10, 11, 12, 13, 14],
45
+ [ 15, 16, 17, 18, 19, 20, 21],
46
+ [ 22, 23, 'H', 'H', 26, 27, 28],
47
+ [ 29, 30, 31, nil, nil, nil, nil]
28
48
  ```
29
49
 
30
50
  ## Contributing
@@ -2,9 +2,8 @@ require 'date'
2
2
 
3
3
  module Mcal
4
4
  class Calendar
5
- def initialize(year, holidays=[])
5
+ def initialize(year)
6
6
  @year = year
7
- @holidays = holidays
8
7
  end
9
8
 
10
9
  def monthly(month, &block)
@@ -1,3 +1,3 @@
1
1
  module Mcal
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Roes