tempora 0.2.1 → 0.2.3
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 +4 -4
- data/lib/month.rb +2 -0
- data/lib/quarter.rb +2 -0
- data/lib/tempora/has_time.rb +11 -0
- data/lib/tempora/version.rb +1 -1
- data/lib/timeperiod.rb +9 -5
- data/lib/week.rb +2 -0
- data/lib/year.rb +2 -0
- data/tempora-0.2.1.gem +0 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b630dbc05e1a683a8369f67134b1e932ff63e09fc80b245cbdbd3941e0a023cb
|
4
|
+
data.tar.gz: 160c210a40b0991ee446242aa6a2fa1a848828466ed82aa76e61a284e7f4a0b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bb2d6bf2ba656c6f55c894a5f9145f76a989263f7d71911a8930b7b883839b3b4b8197868b1edc305229f61645ba6ca0d4bc15d953fdf03801a98a81bd7e5dc
|
7
|
+
data.tar.gz: 52cb48a2a9e9534aa08fff490403125f04d0b03cce7ef4a7b3f03c2bfc4acbc7498654ca8059d21ec00ae43020504f68ca59d88f27c5a7ecd93d1d8df3d97a0d
|
data/lib/month.rb
CHANGED
data/lib/quarter.rb
CHANGED
data/lib/tempora/version.rb
CHANGED
data/lib/timeperiod.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
require 'date'
|
2
2
|
require_relative 'tempora/has_days'
|
3
|
+
require_relative 'tempora/has_time'
|
3
4
|
|
4
5
|
module Tempora
|
5
6
|
class TimePeriod
|
6
7
|
include Comparable
|
7
8
|
include HasDays
|
9
|
+
include HasTime
|
8
10
|
|
9
|
-
attr_reader :start_date, :end_date
|
11
|
+
attr_reader :start_date, :end_date
|
10
12
|
|
11
13
|
def initialize(start_date, end_date)
|
12
14
|
@start_date = start_date
|
@@ -33,7 +35,7 @@ module Tempora
|
|
33
35
|
return nil unless overlaps?(other)
|
34
36
|
|
35
37
|
new_start = [start_date, other.start_date].max
|
36
|
-
new_end
|
38
|
+
new_end = [end_date, other.end_date].min
|
37
39
|
|
38
40
|
TimePeriod.new(new_start, new_end)
|
39
41
|
end
|
@@ -46,8 +48,10 @@ module Tempora
|
|
46
48
|
start_date <=> other.start_date
|
47
49
|
end
|
48
50
|
|
49
|
-
alias_method :begin,
|
50
|
-
alias_method :
|
51
|
-
alias_method :
|
51
|
+
alias_method :begin, :start_date
|
52
|
+
alias_method :first_day, :start_date
|
53
|
+
alias_method :end, :end_date
|
54
|
+
alias_method :last_day, :end_date
|
55
|
+
alias_method :length, :duration
|
52
56
|
end
|
53
57
|
end
|
data/lib/week.rb
CHANGED
data/lib/year.rb
CHANGED
data/tempora-0.2.1.gem
ADDED
Binary file
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tempora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Power
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-02-
|
10
|
+
date: 2025-02-20 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: Tempora is a lightweight Ruby library for handling months, weeks, quarters,
|
13
13
|
and years with intuitive date-based calculations and range support.
|
@@ -25,6 +25,7 @@ files:
|
|
25
25
|
- lib/tempora.rb
|
26
26
|
- lib/tempora/has_days.rb
|
27
27
|
- lib/tempora/has_months.rb
|
28
|
+
- lib/tempora/has_time.rb
|
28
29
|
- lib/tempora/has_weeks.rb
|
29
30
|
- lib/tempora/initialization.rb
|
30
31
|
- lib/tempora/version.rb
|
@@ -32,6 +33,7 @@ files:
|
|
32
33
|
- lib/week.rb
|
33
34
|
- lib/year.rb
|
34
35
|
- sig/tempus.rbs
|
36
|
+
- tempora-0.2.1.gem
|
35
37
|
homepage: https://github.com/max-power/tempora
|
36
38
|
licenses:
|
37
39
|
- MIT
|