src/examples/openflow_message/example.rb in trema-0.4.6 vs src/examples/openflow_message/example.rb in trema-0.4.7
- old
+ new
@@ -21,15 +21,15 @@
module Example
class << self
attr_accessor :count, :datapath_id
- def options_parse args
+ def options_parse(args)
case args.length
when 2
- @datapath_id = args[ 0 ] =~ /^0x/ ? args[ 0 ].hex : args[ 0 ].to_i
- @count = args[ 1 ].to_i
+ @datapath_id = args[ 0] =~ /^0x/ ? args[ 0].hex : args[ 0].to_i
+ @count = args[ 1].to_i
else
return false
end
end
@@ -38,17 +38,17 @@
"Usage: #{ File.basename __FILE__ } datapath_id, count"
end
end
- def may_raise_error msg_datapath_id
- raise ArgumentError, "Given datapath_id does not match configured datapath_id" if msg_datapath_id != Example::datapath_id
+ def may_raise_error(msg_datapath_id)
+ fail ArgumentError, 'Given datapath_id does not match configured datapath_id' if msg_datapath_id != Example::datapath_id
end
- def send_nr_msgs kclass
+ def send_nr_msgs(kclass)
Example::count.times do
- self.send_message Example::datapath_id, kclass.new
+ send_message Example::datapath_id, kclass.new
end
end
end