Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- module IcmpPoller
- def poll
- puts "ICMP Polling #{@id}"
- end
- end
- module SnmpPoller
- def poll
- puts "SNMP Polling #{@id}"
- end
- end
- class Device
- def initialize
- @id = 5
- end
- def poll
- [IcmpPoller, SnmpPoller].each do |poller|
- puts "Running #{poller}"
- poller.instance_method(:poll).bind(self).call
- end
- end
- end
- d = Device.new
- d.poll
Add Comment
Please, Sign In to add comment