mcalendar 0.5.4 → 0.5.5

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
  SHA256:
3
- metadata.gz: c413c998aafb8d17962a9610bad85958075a2779d7fc1cbf0859037ffe5c8e95
4
- data.tar.gz: 931462951e2ee6ae342405aad95e7a09d93d6e1a315d4c593b9f2e2c368894cf
3
+ metadata.gz: ac015db20949925d06ccf0e5f37e6cda175d161c73761e716aad6038c7280511
4
+ data.tar.gz: 28d599a9eb429270732f2e7d216eb0969212325a1f42efad84da7fc94a92ddfe
5
5
  SHA512:
6
- metadata.gz: 833c63b6fa24b4f5b18b505ede13cd069b9fccff1cdbf83ba2c1b1bd482c8b23a8c6eb1967090d5b68af0e288ecc3330b1f4225c19b272512b2c5e1d4c57da64
7
- data.tar.gz: 0d83b7e80cd2b54a005919a95da5e5f34cda5604a1512f6f53e3c283b147843195edbc920c7fe86d80a8720dbd2b6d427b5fda6a2d0224098d7d7734d4b0441a
6
+ metadata.gz: f5d978d7361405ac362dde8e36f1a435a9e4391673a92350b9bbe1b3659a569374e764a92dab89686aab3e20ee01d9650d04d973063210540278f8bc67f8d13f
7
+ data.tar.gz: 9750e02a0e79139e039dccc4fb6bfa46e0090b4193f7006378717bf81940b9aca214057ce1605dd51a68258ff8f450cf2757b0a0bf9c4773b001b13565c645fe
@@ -26,11 +26,31 @@ module Mcalendar
26
26
  first_of_month.strftime("%B %Y")
27
27
  end
28
28
 
29
+ def this_month_calendar?
30
+ (Date.today.year == @year) && (Date.today.month == @month)
31
+ end
32
+
33
+ def reverse_color(day_str)
34
+ "\e[7m" + day_str.to_s + "\e[0m"
35
+ end
36
+
37
+ def reverse_todays_date
38
+ today_str = format("%2s", Date.today.day.to_s)
39
+
40
+ if this_month_calendar?
41
+ month_days = days.map {|x| x.sub(today_str, reverse_color(today_str))}
42
+ else
43
+ month_days = days
44
+ end
45
+
46
+ month_days
47
+ end
48
+
29
49
  def to_s
30
50
  week_header = Mcalendar::DAY_OF_WEEK.join(" ")
31
51
  month_header = month_title.center(week_header.size).rstrip
32
52
  calendar = [[week_header]]
33
- days.each_slice(7) {|x| calendar << [x.join(" ")]}
53
+ reverse_todays_date.each_slice(7) {|x| calendar << [x.join(" ")]}
34
54
  [month_header, calendar]
35
55
  end
36
56
 
@@ -1,3 +1,3 @@
1
1
  module Mcalendar
2
- VERSION = "0.5.4"
2
+ VERSION = "0.5.5"
3
3
  end
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.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - icm7216
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-24 00:00:00.000000000 Z
11
+ date: 2022-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prawn