Method: Fairy::Export#export_elements
- Defined in:
- lib/fairy/share/port.rb
#export_elements(elements) ⇒ Object
buf = []
elements.each do |e|
if PORT_KEEP_IDENTITY_CLASS_SET[e.class]
start = 0 while buf.size > start @output.push_buf buf[start, start+max] start += max end
@output.push e
buf = buf.clear
else
buf.push e
end
end
start = 0 while buf.size > start @output.push_buf buf[start, start+max] start += max end buf.clear
else
start = 0 while elements.size > start @output.push_buf elements[start, start+max] start += max end elements.clear
end
end
675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 |
# File 'lib/fairy/share/port.rb', line 675 def export_elements(elements) start = 0 string_p = nil elements.each_with_index do |e, idx| if @STR_TRANSFAR if e.class == String string_p = true elsif string_p.nil? string_p = false elsif string_p exports_elements_sub_str(elements, start, idx-1) start = idx string_p = nil end end if PORT_KEEP_IDENTITY_CLASS_SET[e.class] exports_elements_sub(elements, start, idx-1) sended = nil @export_mx.synchronize do @output.asynchronus_send_with_callback(:push_keep_identity, e){ @export_mx.synchronize do sended = true @export_cv.broadcast end } @export_cv.wait_until{sended} end start = idx + 1 end end # @output.push_buf elements if string_p exports_elements_sub_str(elements, start, elements.size-1) else exports_elements_sub(elements, start, elements.size-1) end elements.clear end |