Sha256: b6f8b97ae73e0fc6c39cb5c46f516404516c4e2bbeeaa30cdece7547518e324c

Contents?: true

Size: 599 Bytes

Versions: 2

Compression:

Stored size: 599 Bytes

Contents

# Copyright 2007 Jeff Mesnil (http://jmesnil.net)
#
# This file adds methods to CompositeData proxies so that they can behave like
# regular (read-only) Ruby Hash
require 'java'

JavaUtilities.extend_proxy('javax.management.openmbean.CompositeDataSupport') do
  include Enumerable
  def each
    self.get_composite_type.key_set.each do |k|
      yield(k,self.get(k))
    end
    self
  end

  def key?(k)
    self.contains_key k
  end
  alias has_key? key?
  alias include? key?
  alias member? key?
  
  def keys
    self.get_composite_type.key_set
  end
  
  def [](key)
    self.get key
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jmx4r-0.0.4 lib/open_data_helper.rb
jmx4r-0.0.5 lib/open_data_helper.rb