Class: Neo4j::Core::Query::Parameters

Inherits:
Object
  • Object
show all
Defined in:
lib/neo4j-core/query.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash = nil) ⇒ Parameters

Returns a new instance of Parameters.



22
23
24
# File 'lib/neo4j-core/query.rb', line 22

def initialize(hash = nil)
  @parameters = (hash || {})
end

Instance Method Details

#add_param(key, value) ⇒ Object



34
35
36
37
38
# File 'lib/neo4j-core/query.rb', line 34

def add_param(key, value)
  free_param_key(key).tap do |k|
    @parameters[k.freeze] = value
  end
end

#add_params(params) ⇒ Object



44
45
46
47
48
# File 'lib/neo4j-core/query.rb', line 44

def add_params(params)
  params.map do |key, value|
    add_param(key, value)
  end
end

#copyObject



30
31
32
# File 'lib/neo4j-core/query.rb', line 30

def copy
  self.class.new(@parameters.dup)
end

#remove_param(key) ⇒ Object



40
41
42
# File 'lib/neo4j-core/query.rb', line 40

def remove_param(key)
  @parameters.delete(key.to_sym)
end

#to_hashObject



26
27
28
# File 'lib/neo4j-core/query.rb', line 26

def to_hash
  @parameters
end