Class: CanCanCan::ActiveGraph::RuleCypher
- Inherits:
-
Object
- Object
- CanCanCan::ActiveGraph::RuleCypher
- Defined in:
- lib/cancancan/active_graph/rule_cypher.rb
Overview
Constructs cypher conditions for rule and cypher match classes
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#rule_conditions ⇒ Object
readonly
Returns the value of attribute rule_conditions.
Instance Method Summary collapse
- #construct_cypher_conditions ⇒ Object
-
#initialize(options) ⇒ RuleCypher
constructor
A new instance of RuleCypher.
- #initialize_path ⇒ Object
Constructor Details
#initialize(options) ⇒ RuleCypher
Returns a new instance of RuleCypher.
9 10 11 12 13 14 |
# File 'lib/cancancan/active_graph/rule_cypher.rb', line 9 def initialize() @options = @rule_conditions = {} initialize_path construct_cypher_conditions end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/cancancan/active_graph/rule_cypher.rb', line 7 def @options end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/cancancan/active_graph/rule_cypher.rb', line 7 def path @path end |
#rule_conditions ⇒ Object (readonly)
Returns the value of attribute rule_conditions.
7 8 9 |
# File 'lib/cancancan/active_graph/rule_cypher.rb', line 7 def rule_conditions @rule_conditions end |
Instance Method Details
#construct_cypher_conditions ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/cancancan/active_graph/rule_cypher.rb', line 24 def construct_cypher_conditions conditions = @options[:rule].conditions if conditions.is_a?(::ActiveGraph::Node::Query::QueryProxy) return @options[:scope] = conditions end if conditions.blank? condition_for_rule_without_conditions else end end |
#initialize_path ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/cancancan/active_graph/rule_cypher.rb', line 16 def initialize_path model_class = @options[:model_class] var_label = CypherConstructorHelper.var_name(model_class) var_label += index_sub_str @options[:var_label] = var_label @path = CypherConstructorHelper.path_node(model_class, var_label) end |