Class: Atomy::Pattern::Equality
- Inherits:
-
Atomy::Pattern
- Object
- Atomy::Pattern
- Atomy::Pattern::Equality
- Defined in:
- lib/atomy/pattern/equality.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from Atomy::Pattern
Instance Method Summary collapse
-
#initialize(value) ⇒ Equality
constructor
A new instance of Equality.
- #inline_matches?(gen) ⇒ Boolean
- #matches?(val) ⇒ Boolean
- #target ⇒ Object
Methods inherited from Atomy::Pattern
Constructor Details
#initialize(value) ⇒ Equality
Returns a new instance of Equality.
7 8 9 |
# File 'lib/atomy/pattern/equality.rb', line 7 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
5 6 7 |
# File 'lib/atomy/pattern/equality.rb', line 5 def value @value end |
Instance Method Details
#inline_matches?(gen) ⇒ Boolean
15 16 17 18 19 |
# File 'lib/atomy/pattern/equality.rb', line 15 def inline_matches?(gen) push_value(gen) gen.swap gen.send(:==, 1) end |
#matches?(val) ⇒ Boolean
11 12 13 |
# File 'lib/atomy/pattern/equality.rb', line 11 def matches?(val) @value == val end |
#target ⇒ Object
21 22 23 |
# File 'lib/atomy/pattern/equality.rb', line 21 def target @value.class end |