Class: CypherBuilder::Payload

Inherits:
Object
  • Object
show all
Defined in:
lib/cypher_builder/payload.rb

Defined Under Namespace

Classes: WithStatus

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Payload

Returns a new instance of Payload.



8
9
10
# File 'lib/cypher_builder/payload.rb', line 8

def initialize(params)
  @params = params.map { |k, v| [k.to_sym, with_status(v, :pending)] }.to_h
end

Instance Method Details

#already_used(param_name) ⇒ Object



16
17
18
# File 'lib/cypher_builder/payload.rb', line 16

def already_used(param_name)
  set_status(param_name, :already_used) unless get_status(param_name) == :will_be_used
end

#include?(param_name) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/cypher_builder/payload.rb', line 20

def include?(param_name)
  @params.keys.include?(param_name)
end

#necessaryObject



28
29
30
# File 'lib/cypher_builder/payload.rb', line 28

def necessary
  select(:will_be_used)
end

#pendingsObject



24
25
26
# File 'lib/cypher_builder/payload.rb', line 24

def pendings
  select(:pending)
end

#will_be_used(param_name) ⇒ Object



12
13
14
# File 'lib/cypher_builder/payload.rb', line 12

def will_be_used(param_name)
  set_status(param_name, :will_be_used)
end