Class: TimeDateMatcher
Instance Attribute Summary collapse
-
#instance ⇒ Object
readonly
Returns the value of attribute instance.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
-
#initialize(instance) ⇒ TimeDateMatcher
constructor
A new instance of TimeDateMatcher.
Constructor Details
#initialize(instance) ⇒ TimeDateMatcher
Returns a new instance of TimeDateMatcher.
10 11 12 |
# File 'lib/core_extensions.rb', line 10 def initialize(instance) @instance = instance end |
Instance Attribute Details
#instance ⇒ Object (readonly)
Returns the value of attribute instance.
9 10 11 |
# File 'lib/core_extensions.rb', line 9 def instance @instance end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/core_extensions.rb', line 13 def ==(other) # allow nils to match return true if other.nil? # attempt to parse any strings if other.is_a?(String) begin other = self.instance.class.parse(other) rescue => e return false end end self.instance.class == other.class end |