Class: Vertx::SharedData::SharedHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/vertx/shared_data.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ SharedHash

Returns a new instance of SharedHash.



81
82
83
84
85
# File 'lib/vertx/shared_data.rb', line 81

def initialize(hash)
  @hash = hash
  # Pass the object to be delegated to the superclass.
  super(@hash)
end

Instance Method Details

#==(other) ⇒ Object



102
103
104
105
106
107
108
# File 'lib/vertx/shared_data.rb', line 102

def ==(other)
  if other.is_a?(SharedHash)
    @hash.equal?(other._to_java_map)
  else
    false
  end
end

#[](key) ⇒ Object



95
96
97
98
99
100
# File 'lib/vertx/shared_data.rb', line 95

def [](key)
  # We call the java class directly
  obj = @hash.get(key)
  obj = Buffer.new(obj) if obj.is_a? org.vertx.java.core.buffer.Buffer
  obj
end

#[]=(key, val) ⇒ Object Also known as: store



87
88
89
90
91
# File 'lib/vertx/shared_data.rb', line 87

def []=(key, val)
  key = SharedData.check_obj(key)
  val = SharedData.check_obj(val)
  super(key, val)
end

#_to_java_mapObject



110
111
112
# File 'lib/vertx/shared_data.rb', line 110

def _to_java_map
  @hash
end