Class: JsshHash

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



1051
1052
1053
1054
1055
# File 'lib/vapir-firefox/jssh_socket.rb', line 1051

def each
  keys.each do |key|
    yield [key, self[key]]
  end
end

#each_pairObject



1056
1057
1058
1059
1060
# File 'lib/vapir-firefox/jssh_socket.rb', line 1056

def each_pair
  each do |(k,v)|
    yield k,v
  end
end

#keysObject



1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
# File 'lib/vapir-firefox/jssh_socket.rb', line 1041

def keys
  keyfunc="function(obj)
           { var keys=[];
             for(var key in obj)
             { keys.push(key);
             }
             return keys;
           }"
  @keys=jssh_socket.object(keyfunc).pass(self).val
end

#to_json(options = {}) ⇒ Object

Enumerable clobbers this; redefine



1063
1064
1065
# File 'lib/vapir-firefox/jssh_socket.rb', line 1063

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