tempora 0.2.1 → 0.2.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: 1af2de3467a21cc28a33db0590f6934e0892cd6fca23f51183b16252b5f91016
4
- data.tar.gz: d0365bb120ea9e0a42e768382136efff98ab25d88343c3876db913ceafd00a93
3
+ metadata.gz: 89b87271bfd8ca786ad770cdeb844a192d657363dcb55585edb5cc1b7d043714
4
+ data.tar.gz: 754ec4aad6c5c5ef115eea19ac6f01767d4cda2e8ba97cfb07aa72c4566d40d6
5
5
  SHA512:
6
- metadata.gz: 5d21b7f7290f12435d5e77aae4221022dfa0db3b242ad3506edf9bdd446866bc1db576759ea91f5517c8a0b988f159d42517ddd1656beca618384cb46e66de0b
7
- data.tar.gz: efbab1ef415bfb7eaa6ffd6877e07d16efe49219a3376437e451cf4a75c3c6076b2d8fc0f908042d0394fe2392ae144a2ef3859153fd120e3deda523c0192493
6
+ metadata.gz: 6b75b131397179c4538cbe45bf10cec72ac8308d5e7b4297b2addbff3fd7fc707c0d96a70903d6fd8fe843138eb12b9051a9152b334ecb82fc31f90e1285d5b7
7
+ data.tar.gz: cb06dffbdb7f4f5df64732f689c230d52cc492040b6e78b1fbd814c50fe761bd0333d6b6d7520585c1102fcc8cec47108eebcf65d1cd30e3bde5cd84cdc72829
data/lib/month.rb CHANGED
@@ -6,6 +6,8 @@ module Tempora
6
6
  class Month < TimePeriod
7
7
  extend Initialization
8
8
  include HasWeeks
9
+
10
+ attr_reader :year, :number
9
11
 
10
12
  def initialize(year, month)
11
13
  @year = Integer(year)
data/lib/quarter.rb CHANGED
@@ -8,6 +8,8 @@ module Tempora
8
8
  extend Initialization
9
9
  include HasMonths
10
10
  include HasWeeks
11
+
12
+ attr_reader :year, :number
11
13
 
12
14
  def initialize(year, quarter)
13
15
  @year = Integer(year)
@@ -0,0 +1,11 @@
1
+ module Tempora
2
+ module HasTime
3
+ def start_time
4
+ start_date.to_time
5
+ end
6
+
7
+ def end_time
8
+ end_date.next_day.to_time - 1
9
+ end
10
+ end
11
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tempora
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
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, :year, :number
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 = [end_date, other.end_date].min
38
+ new_end = [end_date, other.end_date].min
37
39
 
38
40
  TimePeriod.new(new_start, new_end)
39
41
  end
data/lib/week.rb CHANGED
@@ -5,6 +5,8 @@ module Tempora
5
5
  class Week < TimePeriod
6
6
  extend Initialization
7
7
 
8
+ attr_reader :year, :number
9
+
8
10
  def initialize(year, week)
9
11
  @year = Integer(year)
10
12
  @number = Integer(week)
data/lib/year.rb CHANGED
@@ -8,6 +8,8 @@ module Tempora
8
8
  extend Initialization
9
9
  include HasWeeks
10
10
  include HasMonths
11
+
12
+ attr_reader :year
11
13
 
12
14
  def initialize(year)
13
15
  @year = Integer(year)
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.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Power
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-02-16 00:00:00.000000000 Z
10
+ date: 2025-02-19 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