Class: JsshArray
- Inherits:
-
JsshObject
- Object
- JsshObject
- JsshArray
- Includes:
- Enumerable
- Defined in:
- lib/vapir-firefox/jssh_socket.rb
Overview
this class represents a javascript array - that is, a javascript object that has a ‘length’ attribute which is a non-negative integer, and returns elements at each subscript from 0 to less than than that length.
Instance Attribute Summary
Attributes inherited from JsshObject
#debug_name, #function_result, #jssh_socket, #ref
Instance Method Summary collapse
-
#each ⇒ Object
yields the element at each subscript of this javascript array, from 0 to self.length.
Methods inherited from JsshObject
#%, #*, #+, #-, #/, #<, #<=, #==, #>, #>=, #[], #[]=, always_define_methods, always_define_methods=, #assign, #assign_expr, #assign_or_call_or_val_or_object_by_suffix, #attr, #binary_operator, #call, #define_methods!, #implemented_interfaces, #initialize, #inspect, #instanceof, #invoke, #invoke?, #method_missing, #new, #object_respond_to?, #object_type, #pass, #pretty_print, #respond_to?, #store, #store_rand_object_key, #store_rand_temp, #sub, #to_array, #to_dom, #to_hash, #to_js_array, #to_js_hash, #to_js_hash_safe, #to_ruby_array, #to_ruby_hash, #triple_equals, #type, #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
#each ⇒ Object
yields the element at each subscript of this javascript array, from 0 to self.length.
1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 |
# File 'lib/vapir-firefox/jssh_socket.rb', line 1375 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 |