Class: CanCanCan::Neo4j::RuleCypher
- Inherits:
-
Object
- Object
- CanCanCan::Neo4j::RuleCypher
- Defined in:
- lib/cancancan/neo4j/rule_cypher.rb
Overview
Constructs cypher conditions for rule and cypher match classes
Instance Attribute Summary collapse
-
#cypher_matches ⇒ Object
readonly
Returns the value of attribute cypher_matches.
-
#rule_conditions ⇒ Object
readonly
Returns the value of attribute rule_conditions.
Instance Method Summary collapse
- #append_not_to_conditions? ⇒ Boolean
- #conditions_connector ⇒ Object
- #construct_cypher_conditions ⇒ Object
-
#initialize(options) ⇒ RuleCypher
constructor
A new instance of RuleCypher.
Constructor Details
#initialize(options) ⇒ RuleCypher
Returns a new instance of RuleCypher.
10 11 12 13 14 15 |
# File 'lib/cancancan/neo4j/rule_cypher.rb', line 10 def initialize() @options = @rule_conditions = '' @cypher_matches = [] construct_cypher_conditions end |
Instance Attribute Details
#cypher_matches ⇒ Object (readonly)
Returns the value of attribute cypher_matches.
8 9 10 |
# File 'lib/cancancan/neo4j/rule_cypher.rb', line 8 def cypher_matches @cypher_matches end |
#rule_conditions ⇒ Object (readonly)
Returns the value of attribute rule_conditions.
8 9 10 |
# File 'lib/cancancan/neo4j/rule_cypher.rb', line 8 def rule_conditions @rule_conditions end |
Instance Method Details
#append_not_to_conditions? ⇒ Boolean
29 30 31 |
# File 'lib/cancancan/neo4j/rule_cypher.rb', line 29 def append_not_to_conditions? !rule_conditions_blank? && !@options[:rule].base_behavior end |
#conditions_connector ⇒ Object
25 26 27 |
# File 'lib/cancancan/neo4j/rule_cypher.rb', line 25 def conditions_connector @options[:rule].base_behavior ? ' OR ' : ' AND ' end |
#construct_cypher_conditions ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/cancancan/neo4j/rule_cypher.rb', line 17 def construct_cypher_conditions if @options[:rule].conditions.blank? condition_for_rule_without_conditions else end end |