Class: Stilts::Batch
- Inherits:
-
Object
- Object
- Stilts::Batch
- Defined in:
- lib/stilts/batch.rb
Instance Attribute Summary collapse
-
#images ⇒ Object
Returns the value of attribute images.
Instance Method Summary collapse
-
#<<(image) ⇒ Object
:nodoc:.
-
#deliver ⇒ Object
Send images to Stilts for transformation, first
screen
and translateto_json
. -
#empty? ⇒ Boolean
:nodoc:.
-
#initialize ⇒ Batch
constructor
Batch is just an array of images.
-
#size ⇒ Object
(also: #length)
:nodoc:.
-
#to_json ⇒ Object
Ready images for transport across voidy vastness of teh interweb.
Constructor Details
#initialize ⇒ Batch
Batch is just an array of images
7 8 9 |
# File 'lib/stilts/batch.rb', line 7 def initialize self.images = [] end |
Instance Attribute Details
#images ⇒ Object
Returns the value of attribute images.
4 5 6 |
# File 'lib/stilts/batch.rb', line 4 def images @images end |
Instance Method Details
#<<(image) ⇒ Object
:nodoc:
22 23 24 |
# File 'lib/stilts/batch.rb', line 22 def << image self.images << image end |
#deliver ⇒ Object
Send images to Stilts for transformation, first screen
and translate to_json
12 13 14 |
# File 'lib/stilts/batch.rb', line 12 def deliver Stilts.sender.send_image_transform_data(self.to_json) end |
#empty? ⇒ Boolean
:nodoc:
33 34 35 36 |
# File 'lib/stilts/batch.rb', line 33 def empty? return true if self.size == 0 false end |
#size ⇒ Object Also known as: length
:nodoc:
27 28 29 |
# File 'lib/stilts/batch.rb', line 27 def size self.images.size end |
#to_json ⇒ Object
Ready images for transport across voidy vastness of teh interweb
17 18 19 |
# File 'lib/stilts/batch.rb', line 17 def to_json JSON.generate(self.images.collect{|i| i.to_hash}) end |