Class: Code::Object::Date
- Inherits:
-
Code::Object
- Object
- Code::Object
- Code::Object::Date
- Defined in:
- lib/code/object/date.rb
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(date) ⇒ Date
constructor
A new instance of Date.
- #inspect ⇒ Object
- #to_s ⇒ Object
Methods inherited from Code::Object
#<=>, #==, #call, code_and_operator, #code_and_operator, code_different, #code_different, code_equal_equal, #code_equal_equal, #code_equal_equal_equal, code_equal_equal_equal, code_exclamation_point, #code_exclamation_point, code_exclusive_range, #code_exclusive_range, code_inclusive_range, #code_inclusive_range, code_or_operator, #code_or_operator, code_self, #code_self, code_to_string, #code_to_string, falsy?, #falsy?, #hash, inspect, maybe, multi_fetch, #multi_fetch, repeat, sig, #sig, to_s, truthy?, #truthy?, |
Constructor Details
#initialize(date) ⇒ Date
Returns a new instance of Date.
8 9 10 |
# File 'lib/code/object/date.rb', line 8 def initialize(date) @raw = date end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
6 7 8 |
# File 'lib/code/object/date.rb', line 6 def raw @raw end |
Class Method Details
.call(**args) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/code/object/date.rb', line 16 def self.call(**args) operator = args.fetch(:operator, nil) case operator.to_s when "tomorrow" sig(args) code_tomorrow else super end end |
.code_tomorrow ⇒ Object
28 29 30 31 |
# File 'lib/code/object/date.rb', line 28 def self.code_tomorrow ::Time.zone ||= Time::DEFAULT_ZONE new(::Time.zone.tomorrow) end |
.name ⇒ Object
12 13 14 |
# File 'lib/code/object/date.rb', line 12 def self.name "Date" end |