Class: JsshArray

Inherits:
JsshObject show all
Includes:
Enumerable
Defined in:
lib/vapir-firefox/jssh_socket.rb

Instance Attribute Summary

Attributes inherited from JsshObject

#debug_name, #function_result, #jssh_socket, #ref, #type

Instance Method Summary collapse

Methods inherited from JsshObject

#%, #*, #+, #-, #/, #<, #<=, #==, #>, #>=, #[], #[]=, #assign, #assign_expr, #attr, #binary_operator, #call, #define_methods!, #id, #implemented_interfaces, #initialize, #inspect, #instanceof, #invoke, #method_missing, #object_respond_to?, #object_type, #pass, #pretty_print, #respond_to?, #store, #store_rand_named, #store_rand_object_key, #store_rand_prefix, #store_rand_temp, #sub, #to_array, #to_dom, #to_hash, #to_js_array, #to_js_hash, #to_js_hash_safe, #to_jssh, #to_ruby_hash, #val, #val_or_object, #val_str

Constructor Details

This class inherits a constructor from JsshObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class JsshObject

Instance Method Details

#eachObject

Raises:



1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
# File 'lib/vapir-firefox/jssh_socket.rb', line 1022

def each
  length=self.length
  raise JsshError, "length #{length.inspect} is not a non-negative integer on #{self.ref}" unless length.is_a?(Integer) && length >= 0
  for i in 0...length
    element=self[i]
    if element.is_a?(JsshObject)
      # yield a more permanent reference than the array subscript 
      element=element.store_rand_temp
    end
    yield element
  end
end

#to_json(options = {}) ⇒ Object

Enumerable clobbers this; redefine



1035
1036
1037
# File 'lib/vapir-firefox/jssh_socket.rb', line 1035

def to_json(options={}) # Enumerable clobbers this; redefine
  ref
end