Class: RR::WildcardMatchers::IsA
- Inherits:
-
Object
- Object
- RR::WildcardMatchers::IsA
- Defined in:
- lib/rr/wildcard_matchers/is_a.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
-
#initialize(klass) ⇒ IsA
constructor
A new instance of IsA.
- #inspect ⇒ Object
- #wildcard_match?(other) ⇒ Boolean
Constructor Details
#initialize(klass) ⇒ IsA
Returns a new instance of IsA.
6 7 8 |
# File 'lib/rr/wildcard_matchers/is_a.rb', line 6 def initialize(klass) @klass = klass end |
Instance Attribute Details
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
4 5 6 |
# File 'lib/rr/wildcard_matchers/is_a.rb', line 4 def klass @klass end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
14 15 16 |
# File 'lib/rr/wildcard_matchers/is_a.rb', line 14 def ==(other) other.is_a?(self.class) && klass == other.klass end |
#inspect ⇒ Object
19 20 21 |
# File 'lib/rr/wildcard_matchers/is_a.rb', line 19 def inspect "is_a(#{klass})" end |
#wildcard_match?(other) ⇒ Boolean
10 11 12 |
# File 'lib/rr/wildcard_matchers/is_a.rb', line 10 def wildcard_match?(other) self == other || other.is_a?(klass) end |