ruby/trema/enqueue.rb in trema-0.4.6 vs ruby/trema/enqueue.rb in trema-0.4.7
- old
+ new
@@ -14,12 +14,12 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
-require "trema/action"
-require "trema/monkey-patch/integer"
+require 'trema/action'
+require 'trema/monkey-patch/integer'
module Trema
#
# An action to enqueue the packet on the specified queue attached to
@@ -51,27 +51,27 @@
# @raise [TypeError] if options is not a Hash.
# @raise [ArgumentError] if both port_number and queue_id arguments not supplied.
# @raise [ArgumentError] if port_number is not an unsigned 16-bit integer.
# @raise [ArgumentError] if queue id is not an unsigned 32-bit integer.
#
- def initialize options
- if options.is_a?( Hash )
- @port_number = options[ :port_number ]
- @queue_id = options[ :queue_id ]
+ def initialize(options)
+ if options.is_a?(Hash)
+ @port_number = options[ :port_number]
+ @queue_id = options[ :queue_id]
if @port_number.nil?
- raise ArgumentError, "Port number is a mandatory option"
+ fail ArgumentError, 'Port number is a mandatory option'
end
unless @port_number.unsigned_16bit?
- raise ArgumentError, "Port number must be an unsigned 16-bit integer"
+ fail ArgumentError, 'Port number must be an unsigned 16-bit integer'
end
if @queue_id.nil?
- raise ArgumentError, "Queue ID is a mandatory option"
+ fail ArgumentError, 'Queue ID is a mandatory option'
end
unless @queue_id.unsigned_32bit?
- raise ArgumentError, "Queue ID must be an unsigned 32-bit integer"
+ fail ArgumentError, 'Queue ID must be an unsigned 32-bit integer'
end
else
- raise "Invalid option"
+ fail 'Invalid option'
end
end
end