Class: Simplprinter::Payload
- Inherits:
-
Object
- Object
- Simplprinter::Payload
- Defined in:
- lib/simplprinter/payload.rb
Instance Attribute Summary collapse
-
#iterations_raw ⇒ Object
Returns the value of attribute iterations_raw.
-
#iters_arr ⇒ Object
Returns the value of attribute iters_arr.
-
#payload_raw ⇒ Object
Returns the value of attribute payload_raw.
-
#var ⇒ Object
Returns the value of attribute var.
-
#vars_arr ⇒ Object
Returns the value of attribute vars_arr.
Instance Method Summary collapse
- #add_variable(name, value) ⇒ Object
-
#bundle_it ⇒ Object
def add_iteration(iteration) self.iters_arr << iteration.marshal_dump end.
-
#initialize ⇒ Payload
constructor
A new instance of Payload.
- #new_iteration(name) ⇒ Object
Constructor Details
#initialize ⇒ Payload
Returns a new instance of Payload.
6 7 8 9 10 11 12 13 14 |
# File 'lib/simplprinter/payload.rb', line 6 def initialize self.vars_arr = [] self.iters_arr = [] self.iterations_raw = [] require 'ostruct' self.payload_raw = OpenStruct.new self.var = OpenStruct.new end |
Instance Attribute Details
#iterations_raw ⇒ Object
Returns the value of attribute iterations_raw.
4 5 6 |
# File 'lib/simplprinter/payload.rb', line 4 def iterations_raw @iterations_raw end |
#iters_arr ⇒ Object
Returns the value of attribute iters_arr.
4 5 6 |
# File 'lib/simplprinter/payload.rb', line 4 def iters_arr @iters_arr end |
#payload_raw ⇒ Object
Returns the value of attribute payload_raw.
4 5 6 |
# File 'lib/simplprinter/payload.rb', line 4 def payload_raw @payload_raw end |
#var ⇒ Object
Returns the value of attribute var.
4 5 6 |
# File 'lib/simplprinter/payload.rb', line 4 def var @var end |
#vars_arr ⇒ Object
Returns the value of attribute vars_arr.
4 5 6 |
# File 'lib/simplprinter/payload.rb', line 4 def vars_arr @vars_arr end |
Instance Method Details
#add_variable(name, value) ⇒ Object
16 17 18 |
# File 'lib/simplprinter/payload.rb', line 16 def add_variable(name, value) self.var["#{name}"]= value end |
#bundle_it ⇒ Object
def add_iteration(iteration)
self.iters_arr << iteration.marshal_dump
end
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/simplprinter/payload.rb', line 30 def bundle_it self.vars_arr << var.marshal_dump self.iterations_raw.each do |i| self.iters_arr << i.bundle_it.marshal_dump end self.payload_raw.iterations = self.iters_arr self.payload_raw.variables = self.vars_arr payload = self.payload_raw.marshal_dump.to_json payload end |