periodoxical 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/README.md +14 -18
- data/lib/periodoxical/version.rb +1 -1
- data/lib/periodoxical.rb +9 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 566ebd2f1dcb17516ed1c3deae4b8a51639daa61709f3e850131b6524d158004
|
4
|
+
data.tar.gz: cb121164fc25bd1c975d8df101fbcf5f8b523b5e7f7ea421385fd80b9aaebf3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3b56cbc4e282596b4aa87572ba659711b7342f5413a8f5db293d44888abb0075a7c637cae99fabb7887428960900faba0fed66160fefd56d5c4f43f14c64892
|
7
|
+
data.tar.gz: 2015f24e0209d01e3fde60ee750ea2c9c7865bc07447a7c73514ea935ddc2e9024769f3e7201745e3ef09b3d47a569169de6898cb435f4ecd46f745eb94f0d36
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
periodoxical (0.1.
|
5
|
-
tzinfo (>= 2.0.0)
|
4
|
+
periodoxical (0.1.1)
|
5
|
+
tzinfo (~> 2.0, >= 2.0.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -47,8 +47,8 @@ PLATFORMS
|
|
47
47
|
DEPENDENCIES
|
48
48
|
bundler (~> 2.4)
|
49
49
|
periodoxical!
|
50
|
-
pry-byebug
|
51
|
-
pry-stack_explorer
|
50
|
+
pry-byebug (~> 3.10)
|
51
|
+
pry-stack_explorer (~> 0.6)
|
52
52
|
rake (~> 10.0)
|
53
53
|
rspec (~> 3.0)
|
54
54
|
|
data/README.md
CHANGED
@@ -24,7 +24,7 @@ Or install it yourself as:
|
|
24
24
|
## Usage
|
25
25
|
|
26
26
|
```rb
|
27
|
-
#
|
27
|
+
# Generates 9:00AM - 10:30AM and 2:00PM - 2:30PM time blocks
|
28
28
|
# on Mondays, Wednesdays, and Thursdays, between the dates of
|
29
29
|
# May 23, 2024 and June 24, 2024
|
30
30
|
|
@@ -47,23 +47,19 @@ Periodoxical.generate(
|
|
47
47
|
# returns an array of hashes, each with a :start, :end
|
48
48
|
#=>
|
49
49
|
[
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
:end=>#<DateTime: 2024-05-30T16:00:00+00:00>
|
64
|
-
},
|
65
|
-
|
66
|
-
...
|
50
|
+
{
|
51
|
+
start: #<DateTime: 2024-05-23T16:00:00+00:00>,
|
52
|
+
end: #<DateTime: 2024-05-24T05:30:00+00:00>,
|
53
|
+
},
|
54
|
+
{
|
55
|
+
start: #<DateTime: 2024-05-23T21:00:00+00:00>,
|
56
|
+
end: #<DateTime: 2024-05-23T21:30:00+00:00>,
|
57
|
+
},
|
58
|
+
{
|
59
|
+
start: #<DateTime: 2024-05-27T16:00:00+00:00>,
|
60
|
+
end: #<DateTime: 2024-05-28T05:30:00+00:00>
|
61
|
+
},
|
62
|
+
...
|
67
63
|
]
|
68
64
|
```
|
69
65
|
|
data/lib/periodoxical/version.rb
CHANGED
data/lib/periodoxical.rb
CHANGED
@@ -66,7 +66,7 @@ module Periodoxical
|
|
66
66
|
@time_blocks.each do |tb|
|
67
67
|
times << {
|
68
68
|
start: time_str_to_object(current_date, tb[:start_time]),
|
69
|
-
end: time_str_to_object(current_date, tb[:
|
69
|
+
end: time_str_to_object(current_date, tb[:end_time])
|
70
70
|
}
|
71
71
|
end
|
72
72
|
end
|
@@ -99,7 +99,13 @@ module Periodoxical
|
|
99
99
|
|
100
100
|
def day_of_week_long_to_short(dow)
|
101
101
|
{
|
102
|
-
"
|
102
|
+
"Monday" => "mon",
|
103
|
+
"Tuesday" => "tue",
|
104
|
+
"Wednesday" => "wed",
|
105
|
+
"Thursday" => "thu",
|
106
|
+
"Friday" => "fri",
|
107
|
+
"Saturday" => "sat",
|
108
|
+
"Sunday" => "sun",
|
103
109
|
}[dow]
|
104
110
|
end
|
105
111
|
|
@@ -107,7 +113,7 @@ module Periodoxical
|
|
107
113
|
# Ex: '9:00AM'
|
108
114
|
# @param [Date] date
|
109
115
|
def time_str_to_object(date, time_str)
|
110
|
-
time = Time.strptime(
|
116
|
+
time = Time.strptime(time_str, "%I:%M%p")
|
111
117
|
date_time = DateTime.new(
|
112
118
|
date.year,
|
113
119
|
date.month,
|