Module: Dagraph::EdgeModel

Extended by:
ActiveSupport::Concern
Defined in:
lib/dagraph/edge_model.rb

Instance Method Summary collapse

Instance Method Details

#dependent_implicit_edgesObject



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/dagraph/edge_model.rb', line 44

def dependent_implicit_edges
  edges_list = self.class.where(direct_edge: self).pluck(:id)
  loop do
    new_edges_list = self.class.where.not(id: edges_list)
      .and(
        self.class.where(entry_edge_id: edges_list).or(self.class.where(exit_edge_id: edges_list))
      )
    edges_list += new_edges_list
    break if new_edges_list.empty?
  end

  self.class.where(id: edges_list.excluding(id))
end

#direct?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/dagraph/edge_model.rb', line 32

def direct?
  hops.zero?
end

#implicit?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/dagraph/edge_model.rb', line 36

def implicit?
  !direct?
end

#readonly?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/dagraph/edge_model.rb', line 40

def readonly?
  implicit?
end