Class: Authorize::Graph::UndirectedGraph

Inherits:
Graph show all
Defined in:
lib/authorize/graph/undirected_graph.rb

Constant Summary

Constants inherited from Redis::Base

Redis::Base::NAMESPACE_SEPARATOR

Instance Attribute Summary

Attributes inherited from Graph

#edge_namespace, #vertex_namespace

Attributes inherited from Redis::Base

#id

Instance Method Summary collapse

Methods inherited from Graph

#edge, #edges, exists?, #traverse, #vertex, #vertex_by_name, #vertices

Methods inherited from Redis::Set

#<<, #__getobj__, #add, #delete, #first, #include?, #sample, #valid?

Methods inherited from Redis::Base

#==, #__getobj__, #_dump, _load, connection, connection_base?, connection_manager, #db, #destroy, #eql?, exists?, #exists?, generate_key, #hash, index, load, load_all, #logger, #method_missing, new, next_counter, #reload, #respond_to?, #subordinate_key, subordinate_key, #to_yaml, #valid?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Authorize::Redis::Base

Instance Method Details

#join(id, v0, v1, *args) ⇒ Object

Join two vertices symmetrically so that they become adjacent. Graphs built uniquely with this method will be undirected.



8
9
10
11
# File 'lib/authorize/graph/undirected_graph.rb', line 8

def join(id, v0, v1, *args)
  edge_id = id || subordinate_key("_edges", true)
  !!(edge(edge_id + "-01", v0, v1, *args) && edge(edge_id + "-10", v1, v0, *args))
end