mcalendar 0.3.1 → 0.3.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1beacf564591914f261e7a7391c499c8031a1b7eca6f41cb018808ed06662bd
4
- data.tar.gz: ac452242093d4e691725c8d129b5fe2524ba7a83d6baaf3540c9ff8767387b3b
3
+ metadata.gz: 7f26751cd7124cc591143e0a0fe1cfe6062e0a9a5e3b05d6b6159d7bf5add079
4
+ data.tar.gz: 10c26d535fab1b442877f877eb55251f6a5e728c150d088810221561cac0945e
5
5
  SHA512:
6
- metadata.gz: cbb5e2d7fabb38866013fb45be2db6e89cec29a2afe710ed9af0d2ed0ada7c0e9a9a87fee3ddbb67de8854283f7362b9c95db6e007b2f17d2f1d33f37db41f93
7
- data.tar.gz: a7c9ef7215ce231e20c4bce45a1d21afe285bfe88c23e139a5733b786f6363ea720a57ca5d63879b4a1d1ef7377008a93756bd5eb63887dbb931bba74a55c322
6
+ metadata.gz: 3165f35909445ceb798da668ba224721520e05af8b55823eb92f1074b49cbfba13f33a9296b9814d42d1ffb37b8cce1f1a76eea410267dbe57b10b5ba4407ac9
7
+ data.tar.gz: '0738ea2950b47e1533bd775c3246bd1a377c21ed1875b453b4c3c142838775ef5c209e20370270ae1e41bfd5d8807e6432bafc928fb040963f4733055ce71069'
@@ -32,6 +32,7 @@ module Mcalendar
32
32
  @days_config = Hash.new(nil)
33
33
  days_basic
34
34
  holiday
35
+ anniversary
35
36
  end
36
37
 
37
38
  def self.days_basic
@@ -53,6 +54,22 @@ module Mcalendar
53
54
  end
54
55
  end
55
56
 
57
+ def self.anniversary
58
+ y = "%4d" % @first_of_month.year
59
+ m = "%02d" % @first_of_month.month
60
+ regex = /#{y}#{m}\d\d/
61
+
62
+ Mcalendar::ANNIVERSARY.keys.grep(regex).each do |d|
63
+ @days_config[d].day = Date.parse(d.to_s).day
64
+ if @days_config[d].text.size > 1
65
+ @days_config[d].text += (", " + Mcalendar::ANNIVERSARY[d])
66
+ else
67
+ @days_config[d].text += Mcalendar::ANNIVERSARY[d]
68
+ end
69
+ @days_config[d].color = :black if @days_config[d].color != :red
70
+ end
71
+ end
72
+
56
73
  def self.days
57
74
  pdf_days = @days_config.each_value.map {|val| val}
58
75
  @first_of_month.wday.times {pdf_days.unshift(" ")}
@@ -1,4 +1,6 @@
1
1
  module Mcalendar
2
+
3
+ # Japanese holidays
2
4
  HOLIDAY = {
3
5
  "20200101": "New Year's Day",
4
6
  "20200113": "Coming-of-age Day",
@@ -19,4 +21,11 @@ module Mcalendar
19
21
  "20201103": "Culture Day",
20
22
  "20201123": "Labour Thanksgiving Day"
21
23
  }
24
+
25
+ ANNIVERSARY = {
26
+ "20200224": "Ruby's Birthday",
27
+ "20200809": "RubyKaigi 2020 Nagano",
28
+ "20200810": "RubyKaigi 2020 Nagano",
29
+ "20200811": "RubyKaigi 2020 Nagano"
30
+ }
22
31
  end
@@ -9,7 +9,8 @@ module Mcalendar
9
9
  Mcalendar::Config::days_information(obj_calendar)
10
10
  @pdf_days = Mcalendar::Config::days
11
11
  @calendar = @pdf_days.each_slice(7).map
12
- @cell_height = @calendar.size > 5 ? 50 : 60
12
+ @day_height = @calendar.size > 5 ? 20 : 20
13
+ @text_height = @calendar.size > 5 ? 30 : 40
13
14
 
14
15
  super(page_size: 'A4', margin: 20)
15
16
  calendar_render
@@ -38,10 +39,10 @@ module Mcalendar
38
39
  row_color = c.map {|x| (x.class == Struct::ConfigDay) ? x.color : :black}
39
40
  row_text = c.map {|x| (x.class == Struct::ConfigDay) ? x.text : x}
40
41
 
41
- table([row_day], cell_style: {height: @cell_height / 2}) do
42
+ table([row_day], cell_style: {height: @day_height}) do
42
43
  cells.style(width: 79, align: :center, size: 19)
43
44
  row(0).borders = [:top, :left, :right]
44
- row(0).padding_top = 5
45
+ row(0).padding_top = 2
45
46
  row(0).padding_bottom = 0
46
47
  row_color.each_with_index do |color, index|
47
48
  rows(0).columns(index).text_color = Mcalendar::Config::COLOR[color]
@@ -49,11 +50,10 @@ module Mcalendar
49
50
  column(0).map {|col| col.text_color = Mcalendar::Config::COLOR[:red]}
50
51
  end
51
52
 
52
- table([row_text], cell_style: {height: @cell_height / 2}) do
53
- cells.style(width: 79, align: :center, size: 10)
54
- row(0).style = {overflow: :shrink_to_fit}
53
+ table([row_text], cell_style: {height: @text_height}) do
54
+ cells.style(width: 79, align: :center, size: 8, overflow: :shrink_to_fit)
55
55
  row(0).borders = [:bottom, :left, :right]
56
- row(0).padding_top = 1
56
+ row(0).padding_top = 0
57
57
  row(0).padding_bottom = 0
58
58
  row(0).padding_left = 0
59
59
  row(0).padding_right = 0
@@ -1,3 +1,3 @@
1
1
  module Mcalendar
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcalendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - icm7216