Class: Neo4j::RSpec::Matchers::HasN::BaseMatcher
- Inherits:
-
Object
- Object
- Neo4j::RSpec::Matchers::HasN::BaseMatcher
- Defined in:
- lib/neo4j/rspec/matchers/has_n.rb
Direct Known Subclasses
DirectionMatcher, ModelClassesMatcher, OriginMatcher, TypeMatcher
Instance Attribute Summary collapse
-
#actual ⇒ Object
readonly
Returns the value of attribute actual.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#matcher ⇒ Object
readonly
Returns the value of attribute matcher.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #add ⇒ Object
- #add_negative ⇒ Object
-
#initialize(matcher, value) ⇒ BaseMatcher
constructor
A new instance of BaseMatcher.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(matcher, value) ⇒ BaseMatcher
Returns a new instance of BaseMatcher.
8 9 10 11 |
# File 'lib/neo4j/rspec/matchers/has_n.rb', line 8 def initialize(matcher, value) @matcher = matcher @value = convert_value(value) end |
Instance Attribute Details
#actual ⇒ Object (readonly)
Returns the value of attribute actual.
6 7 8 |
# File 'lib/neo4j/rspec/matchers/has_n.rb', line 6 def actual @actual end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
6 7 8 |
# File 'lib/neo4j/rspec/matchers/has_n.rb', line 6 def key @key end |
#matcher ⇒ Object (readonly)
Returns the value of attribute matcher.
6 7 8 |
# File 'lib/neo4j/rspec/matchers/has_n.rb', line 6 def matcher @matcher end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/neo4j/rspec/matchers/has_n.rb', line 6 def value @value end |
Instance Method Details
#add ⇒ Object
13 14 15 16 17 |
# File 'lib/neo4j/rspec/matchers/has_n.rb', line 13 def add matcher. << matcher.association[key] = self matcher end |
#add_negative ⇒ Object
19 20 21 22 23 |
# File 'lib/neo4j/rspec/matchers/has_n.rb', line 19 def add_negative matcher. << matcher.association[key] = self matcher end |
#matches?(actual) ⇒ Boolean
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/neo4j/rspec/matchers/has_n.rb', line 25 def matches?(actual) @actual = extact_actual(actual) if matches matcher. = false else matcher. = true end end |