Module: TypedDag::Node::InstanceMethods

Extended by:
ActiveSupport::Concern
Defined in:
lib/typed_dag/node/instance_methods.rb

Instance Method Summary collapse

Instance Method Details

#_dag_optionsObject



21
22
23
# File 'lib/typed_dag/node/instance_methods.rb', line 21

def _dag_options
  self.class._dag_options
end

#from_edge(other_node) ⇒ Object



11
12
13
14
# File 'lib/typed_dag/node/instance_methods.rb', line 11

def from_edge(other_node)
  ancestors_relations
    .where(_dag_options.edge_table_name => { _dag_options.from_column => other_node })
end

#in_closure?(other_node) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
# File 'lib/typed_dag/node/instance_methods.rb', line 5

def in_closure?(other_node)
  from_edge(other_node)
    .or(to_edge(other_node))
    .exists?
end

#to_edge(other_node) ⇒ Object



16
17
18
19
# File 'lib/typed_dag/node/instance_methods.rb', line 16

def to_edge(other_node)
  descendants_relations
    .where(_dag_options.edge_table_name => { _dag_options.to_column => other_node })
end