Class: ONVIF::Service
- Inherits:
-
Object
show all
- Defined in:
- lib/ruby_onvif_client/service.rb
Instance Method Summary
collapse
Constructor Details
#initialize(address) ⇒ Service
6
7
8
9
10
|
# File 'lib/ruby_onvif_client/service.rb', line 6
def initialize address
@client = ONVIF::Client.new(
address: address
)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &blcok) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/ruby_onvif_client/service.rb', line 12
def method_missing(m, *args, &blcok)
action_class = ONVIF.const_get(%Q{#{self.class.name}Action}).const_get(m.to_s.camelize) rescue nil
unless action_class.nil?
self.class.class_exec do
define_method m do |*r|
action_class.new(@client).run(*r)
end
end
self.send m, *args
else
super
end
end
|
Instance Method Details
#respond_to?(m, include_private = false) ⇒ Boolean
26
27
28
29
30
31
32
33
|
# File 'lib/ruby_onvif_client/service.rb', line 26
def respond_to?(m, include_private = false)
action_class = ONVIF.const_get(%Q{#{self.class.name}Action}).const_get(m.to_s.camelize) rescue nil
unless action_class.nil?
true
else
super
end
end
|