mcalendar 0.2.3 → 0.2.4

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: fcbc60858456eb075831cb05c8f42459f7e446f31e8d57c4d8f244d1ed8ac3a0
4
- data.tar.gz: 248a5c705642187131f7eb47744c4c768bec5442e8ed900a6399089689b055d5
3
+ metadata.gz: b4f1a0686f0df1be91433adbdde9d74b9be99d2f27604e22bb1013594e20628e
4
+ data.tar.gz: c9a3f6121b369d8f2b47d235a39e321fb20365c1e4eb1564dc712cc96e6e6ad1
5
5
  SHA512:
6
- metadata.gz: 0e5f3c0035fe8dbb307916ac63de8ccbd890cac92afd6f790675786c6f5552581d3ee7039e4e12cc25410536de1f149b32ca72fecf1c6fbded43b2dba61849fd
7
- data.tar.gz: baacdc721cf8552af2616f706894d3707baf4b6ea83b741da8b082934692fc7dae1598d45983259921a2ed9738d4722f60a3d06b59887e0977bad0aa086de93e
6
+ metadata.gz: 2c32d50df9618cb81a32e0f38abe8f0fa2fc7d15f0925d3ec737089d549920475630eb999b3e894e4578640e31f7da8db7a1736b8b6e7239a879e15a3ed842dd
7
+ data.tar.gz: c9fb9883a4295a4066c841a589c65eba589a7ba89f5002975d5e85f00ccc8ce6fcec8188928945cfafe47ebf1476cf8d5603550d26d3effe27a7746991bd0d24
@@ -24,7 +24,7 @@ module Mcalendar
24
24
  end
25
25
 
26
26
  def to_s
27
- week_header = Mcalendar::DAY_OF_WEEK.join(" ")
27
+ week_header = Mcalendar::Config::DAY_OF_WEEK.join(" ")
28
28
  month_header = @month_title.center(week_header.size).rstrip
29
29
  calendar = [[week_header]]
30
30
  @days.each_slice(7) {|x| calendar << [x.join(" ")]}
@@ -0,0 +1,26 @@
1
+ module Mcalendar
2
+ module Config
3
+ COLOR = {
4
+ white: "FFFFFF",
5
+ silver: "C0C0C0",
6
+ gray: "808080",
7
+ black: "000000",
8
+ red: "FF0000",
9
+ maroon: "800000",
10
+ yellow: "FFFF00",
11
+ olive: "808000",
12
+ lime: "00FF00",
13
+ green: "008000",
14
+ aqua: "00FFFF",
15
+ teal: "008080",
16
+ blue: "0000FF",
17
+ navy: "000080",
18
+ fuchsia: "FF00FF",
19
+ purple: "800080",
20
+ orange: "FFA500",
21
+ }
22
+
23
+ DAY_OF_WEEK = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
24
+
25
+ end
26
+ end
@@ -3,8 +3,8 @@ module Mcalendar
3
3
 
4
4
  def initialize(obj_calendar)
5
5
  @month_header = [[obj_calendar.month_title]]
6
- @day_of_week = [Mcalendar::DAY_OF_WEEK]
7
- @calendar = obj_calendar.days.each_slice(7).to_a
6
+ @day_of_week = [Mcalendar::Config::DAY_OF_WEEK]
7
+ @calendar = obj_calendar.days.each_slice(7).map
8
8
  @cell_height = @calendar.size > 5 ? 50 : 60
9
9
 
10
10
  super(page_size: 'A4', margin: 20)
@@ -24,15 +24,28 @@ module Mcalendar
24
24
  cells.style(width: 79, height: 40, align: :center, size: 19)
25
25
  row(0).padding_top = 10
26
26
  row(0).padding_bottom = 0
27
- cells[0, 0].text_color = "FF0000"
27
+ cells[0, 0].text_color = Mcalendar::Config::COLOR[:red]
28
28
  end
29
29
  end
30
-
30
+
31
31
  def day_content
32
- table(@calendar, cell_style: {height: @cell_height}) do
33
- cells.style(width: 79, align: :center, size: 19)
34
- row(0).padding = 15
35
- column(0).map {|c| c.text_color = "FF0000"}
32
+ @calendar.each do |c|
33
+ table([c], cell_style: {height: @cell_height / 2}) do
34
+ cells.style(width: 79, align: :center, size: 19)
35
+ row(0).borders = [:top, :left, :right]
36
+ row(0).padding_top = 10
37
+ row(0).padding_bottom = 0
38
+ column(0).map {|c| c.text_color = Mcalendar::Config::COLOR[:red]}
39
+ end
40
+
41
+ dummy_text = [""] * c.size
42
+ table([dummy_text], cell_style: {height: @cell_height / 2}) do
43
+ cells.style(width: 79, align: :center, size: 10)
44
+ row(0).style = {overflow: :shrink_to_fit}
45
+ row(0).borders = [:bottom, :left, :right]
46
+ row(0).padding_top = 2
47
+ row(0).padding_bottom = 0
48
+ end
36
49
  end
37
50
  end
38
51
 
@@ -1,3 +1,3 @@
1
1
  module Mcalendar
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
data/lib/mcalendar.rb CHANGED
@@ -3,6 +3,7 @@ require "prawn"
3
3
  require "prawn/table"
4
4
  require "optparse"
5
5
 
6
+ require_relative 'mcalendar/config'
6
7
  require_relative 'mcalendar/calendar'
7
8
  require_relative 'mcalendar/command'
8
9
  require_relative 'mcalendar/options'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcalendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - icm7216
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-12 00:00:00.000000000 Z
11
+ date: 2020-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit
@@ -86,6 +86,7 @@ files:
86
86
  - lib/mcalendar.rb
87
87
  - lib/mcalendar/calendar.rb
88
88
  - lib/mcalendar/command.rb
89
+ - lib/mcalendar/config.rb
89
90
  - lib/mcalendar/options.rb
90
91
  - lib/mcalendar/output_pdf.rb
91
92
  - lib/mcalendar/version.rb