Class: Tomlrb::LocalDate
- Inherits:
-
Object
- Object
- Tomlrb::LocalDate
- Extended by:
- Forwardable
- Defined in:
- lib/llm/shell/internal/tomlrb/lib/tomlrb/local_date.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(year, month, day) ⇒ LocalDate
constructor
A new instance of LocalDate.
- #inspect ⇒ Object
- #to_s ⇒ Object
-
#to_time(offset = '-00:00') ⇒ Time
00:00:00 of the date.
Constructor Details
#initialize(year, month, day) ⇒ LocalDate
Returns a new instance of LocalDate.
11 12 13 |
# File 'lib/llm/shell/internal/tomlrb/lib/tomlrb/local_date.rb', line 11 def initialize(year, month, day) @time = Time.new(year, month, day, 0, 0, 0, '-00:00') end |
Instance Method Details
#==(other) ⇒ Object
26 27 28 29 |
# File 'lib/llm/shell/internal/tomlrb/lib/tomlrb/local_date.rb', line 26 def ==(other) other.is_a?(self.class) && to_time == other.to_time end |
#inspect ⇒ Object
31 32 33 |
# File 'lib/llm/shell/internal/tomlrb/lib/tomlrb/local_date.rb', line 31 def inspect "#<#{self.class}: #{self}>" end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/llm/shell/internal/tomlrb/lib/tomlrb/local_date.rb', line 22 def to_s @time.strftime('%F') end |
#to_time(offset = '-00:00') ⇒ Time
Returns 00:00:00 of the date.
17 18 19 20 |
# File 'lib/llm/shell/internal/tomlrb/lib/tomlrb/local_date.rb', line 17 def to_time(offset = '-00:00') return @time if offset == '-00:00' Time.new(year, month, day, 0, 0, 0, offset) end |