Class: Kuby::Docker::TimestampTag
- Inherits:
-
Object
- Object
- Kuby::Docker::TimestampTag
- Extended by:
- T::Sig
- Defined in:
- lib/kuby/docker/timestamp_tag.rb
Constant Summary collapse
- FORMAT =
T.let('%Y%m%d%H%M%S'.freeze, String)
Instance Attribute Summary collapse
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(time) ⇒ TimestampTag
constructor
A new instance of TimestampTag.
- #to_s ⇒ Object
Constructor Details
#initialize(time) ⇒ TimestampTag
Returns a new instance of TimestampTag.
27 28 29 |
# File 'lib/kuby/docker/timestamp_tag.rb', line 27 def initialize(time) @time = T.let(time, Time) end |
Instance Attribute Details
#time ⇒ Object (readonly)
Returns the value of attribute time.
24 25 26 |
# File 'lib/kuby/docker/timestamp_tag.rb', line 24 def time @time end |
Class Method Details
.try_parse(str) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/kuby/docker/timestamp_tag.rb', line 13 def self.try_parse(str) time = begin Time.strptime(str, FORMAT) rescue ArgumentError return nil end new(time) end |
Instance Method Details
#<=>(other) ⇒ Object
37 38 39 |
# File 'lib/kuby/docker/timestamp_tag.rb', line 37 def <=>(other) time <=> other.time end |
#==(other) ⇒ Object
42 43 44 |
# File 'lib/kuby/docker/timestamp_tag.rb', line 42 def ==(other) time == other.time end |
#eql?(other) ⇒ Boolean
52 53 54 |
# File 'lib/kuby/docker/timestamp_tag.rb', line 52 def eql?(other) time == other.time end |
#hash ⇒ Object
47 48 49 |
# File 'lib/kuby/docker/timestamp_tag.rb', line 47 def hash time.hash end |
#to_s ⇒ Object
32 33 34 |
# File 'lib/kuby/docker/timestamp_tag.rb', line 32 def to_s time.strftime(FORMAT) end |