Class: Neo4j::Core::Query::Parameters
- Inherits:
-
Object
- Object
- Neo4j::Core::Query::Parameters
- Defined in:
- lib/neo4j-core/query.rb
Instance Method Summary collapse
- #add_param(key, value) ⇒ Object
- #add_params(params) ⇒ Object
- #copy ⇒ Object
-
#initialize(hash = nil) ⇒ Parameters
constructor
A new instance of Parameters.
- #remove_param(key) ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(hash = nil) ⇒ Parameters
Returns a new instance of Parameters.
23 24 25 |
# File 'lib/neo4j-core/query.rb', line 23 def initialize(hash = nil) @parameters = (hash || {}) end |
Instance Method Details
#add_param(key, value) ⇒ Object
35 36 37 38 39 |
# File 'lib/neo4j-core/query.rb', line 35 def add_param(key, value) free_param_key(key).tap do |k| @parameters[k.freeze] = value end end |
#add_params(params) ⇒ Object
45 46 47 48 49 |
# File 'lib/neo4j-core/query.rb', line 45 def add_params(params) params.map do |key, value| add_param(key, value) end end |
#copy ⇒ Object
31 32 33 |
# File 'lib/neo4j-core/query.rb', line 31 def copy self.class.new(@parameters.dup) end |
#remove_param(key) ⇒ Object
41 42 43 |
# File 'lib/neo4j-core/query.rb', line 41 def remove_param(key) @parameters.delete(key.to_sym) end |
#to_hash ⇒ Object
27 28 29 |
# File 'lib/neo4j-core/query.rb', line 27 def to_hash @parameters end |