Class: ORTC::MultiMessage
- Inherits:
-
Object
- Object
- ORTC::MultiMessage
- Defined in:
- lib/ortc/ortc_extensibility.rb
Instance Attribute Summary collapse
-
#ready_parts ⇒ Object
readonly
Returns the value of attribute ready_parts.
-
#total_parts ⇒ Object
readonly
Returns the value of attribute total_parts.
Instance Method Summary collapse
- #get_all ⇒ Object
-
#initialize(total_parts) ⇒ MultiMessage
constructor
A new instance of MultiMessage.
- #is_ready ⇒ Object
- #set_part(part_id, part) ⇒ Object
Constructor Details
#initialize(total_parts) ⇒ MultiMessage
Returns a new instance of MultiMessage.
20 21 22 23 24 |
# File 'lib/ortc/ortc_extensibility.rb', line 20 def initialize(total_parts) @total_parts = total_parts @ready_parts = 0 @parts = Array.new total_parts end |
Instance Attribute Details
#ready_parts ⇒ Object (readonly)
Returns the value of attribute ready_parts.
19 20 21 |
# File 'lib/ortc/ortc_extensibility.rb', line 19 def ready_parts @ready_parts end |
#total_parts ⇒ Object (readonly)
Returns the value of attribute total_parts.
19 20 21 |
# File 'lib/ortc/ortc_extensibility.rb', line 19 def total_parts @total_parts end |
Instance Method Details
#get_all ⇒ Object
35 36 37 |
# File 'lib/ortc/ortc_extensibility.rb', line 35 def get_all return @parts.join("") end |
#is_ready ⇒ Object
31 32 33 |
# File 'lib/ortc/ortc_extensibility.rb', line 31 def is_ready return true if @ready_parts == @total_parts end |
#set_part(part_id, part) ⇒ Object
26 27 28 29 |
# File 'lib/ortc/ortc_extensibility.rb', line 26 def set_part(part_id, part) @ready_parts+=1 if @parts[part_id]==nil @parts[part_id] = part end |