class CanCanCan::ActiveGraph::CypherConstructorHelper
Cypher query constructs
Public Class Methods
path_end_var(relationship, conditions)
click to toggle source
# File lib/cancancan/active_graph/cypher_constructor_helper.rb, line 25 def path_end_var(relationship, conditions) with_var = variable_in_path?(relationship, conditions) target_class = relationship.target_class with_var ? var_name(target_class) : '' end
path_node(target_class, var_label)
click to toggle source
# File lib/cancancan/active_graph/cypher_constructor_helper.rb, line 10 def path_node(target_class, var_label) label = target_class.mapped_label_names .map { |label_name| ":`#{label_name}`" } .join "(#{var_label}#{label})" end
var_name(class_constant)
click to toggle source
# File lib/cancancan/active_graph/cypher_constructor_helper.rb, line 6 def var_name(class_constant) class_constant.name.downcase.split('::').join('_') end
variable_in_path?(relationship, conditions)
click to toggle source
# File lib/cancancan/active_graph/cypher_constructor_helper.rb, line 17 def variable_in_path?(relationship, conditions) boolean = [TrueClass, FalseClass].include?(conditions.class) return false if conditions.blank? || boolean !relationship.target_class .associations[conditions.keys.first] .present? end