Module: Backstage::HasMBean
Defined Under Namespace
Modules: ClassMethods
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/has_mbean.rb', line 40
def method_missing(method, *args, &block)
if args.length == 0
begin
return mbean[method.to_s.camelize]
rescue Exception => e
end
end
mbean.send( method, *args, &block )
rescue NoMethodError => ex
super
end
|
Class Method Details
.included(base) ⇒ Object
22
23
24
25
|
# File 'lib/has_mbean.rb', line 22
def self.included(base)
base.send( :attr_accessor, :mbean_name, :mbean )
base.extend( ClassMethods )
end
|
Instance Method Details
#<=>(other) ⇒ Object
32
33
34
|
# File 'lib/has_mbean.rb', line 32
def <=>(other)
full_name <=> other.full_name
end
|
#full_name ⇒ Object
36
37
38
|
# File 'lib/has_mbean.rb', line 36
def full_name
mbean_name.to_s
end
|
#initialize(mbean_name, mbean) ⇒ Object
27
28
29
30
|
# File 'lib/has_mbean.rb', line 27
def initialize(mbean_name, mbean)
self.mbean_name = mbean_name
self.mbean = mbean
end
|
#mbean_info ⇒ Object
54
55
56
|
# File 'lib/has_mbean.rb', line 54
def mbean_info
self.class.mbean_info( mbean_name )
end
|