Sha256: edcb88eb6bf9f89ebd015ae506b539183cc615e8fbd48783b1a2ac19e1a6cf29
Contents?: true
Size: 669 Bytes
Versions: 3
Compression:
Stored size: 669 Bytes
Contents
require 'forwardable' module Tomlrb class LocalDate extend Forwardable def_delegators :@time, :year, :month, :day def initialize(year, month, day) @time = Time.new(year, month, day, 0, 0, 0, '-00:00') end # @param offset see {LocalDateTime#to_time} # @return [Time] 00:00:00 of the date def to_time(offset='-00:00') return @time if offset == '-00:00' Time.new(year, month, day, 0, 0, 0, offset) end def to_s @time.strftime('%F') end def ==(other) other.kind_of?(self.class) && to_time == other.to_time end def inspect "#<#{self.class}: #{to_s}>" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tomlrb-2.0.3 | lib/tomlrb/local_date.rb |
tomlrb-2.0.2 | lib/tomlrb/local_date.rb |
tomlrb-2.0.1 | lib/tomlrb/local_date.rb |