Class: CypherBuilder::Context
- Inherits:
-
Object
- Object
- CypherBuilder::Context
- Defined in:
- lib/cypher_builder/infra/context.rb
Instance Method Summary collapse
- #add(part) ⇒ Object
- #ancestor?(a_class) ⇒ Boolean
-
#initialize(context = []) ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize(context = []) ⇒ Context
Returns a new instance of Context.
2 3 4 |
# File 'lib/cypher_builder/infra/context.rb', line 2 def initialize(context = []) @parents = context end |
Instance Method Details
#add(part) ⇒ Object
6 7 8 |
# File 'lib/cypher_builder/infra/context.rb', line 6 def add(part) Context.new([part] + @parents) end |
#ancestor?(a_class) ⇒ Boolean
10 11 12 |
# File 'lib/cypher_builder/infra/context.rb', line 10 def ancestor?(a_class) @parents.find { |p| a_class === p } end |