Sha256: 2f048b4adef92e7e58c770345a9fe825948931527fae3c96bc6929ee7e57200e
Contents?: true
Size: 724 Bytes
Versions: 4
Compression:
Stored size: 724 Bytes
Contents
# frozen_string_literal: true class Code class Object class Duration < Object attr_reader :raw def initialize(duration) @raw = duration end def self.name "Duration" end def call(**args) operator = args.fetch(:operator, nil) case operator.to_s when "ago" sig(args) code_ago when "from_now" sig(args) code_from_now else super end end def code_ago Time.new(raw.ago) end def code_from_now Time.new(raw.from_now) end def inspect to_s end def to_s raw.to_s end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
code-ruby-0.9.0 | lib/code/object/duration.rb |
code-ruby-0.8.5 | lib/code/object/duration.rb |
code-ruby-0.8.4 | lib/code/object/duration.rb |
code-ruby-0.8.3 | lib/code/object/duration.rb |