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



1082
1083
1084
1085
1086
# File 'lib/vapir-firefox/jssh_socket.rb', line 1082

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

#each_pairObject



1087
1088
1089
1090
1091
# File 'lib/vapir-firefox/jssh_socket.rb', line 1087

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

#keysObject



1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
# File 'lib/vapir-firefox/jssh_socket.rb', line 1072

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



1094
1095
1096
# File 'lib/vapir-firefox/jssh_socket.rb', line 1094

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