lib/ruby_ext/prepare_arguments.rb in ruby-ext-0.2.16 vs lib/ruby_ext/prepare_arguments.rb in ruby-ext-0.4.0
- old
+ new
@@ -1,11 +1,11 @@
class ArgumentsParser
class << self
def register method, arguments
# check and prepare metadata
arguments.collect!{|meta| meta.is_a?(Hash) ? meta : {:type => meta}}
- arguments.each{|meta| meta.should! :include, :type}
+ arguments.each{|meta| meta.must.include :type}
# register
@registry ||= {}
@registry[method] = arguments
end
@@ -14,11 +14,11 @@
metadata = @registry[method]
index = 0
parsed_args = metadata.collect do |options|
send options[:type], args, block, options, index, (index == metadata.size - 1)
end
- args.should_be! :empty
+ args.must_be.empty
return parsed_args
end
protected
def string args, block, options, index, last
@@ -32,11 +32,11 @@
nil
else
args.shift
end
else
- should! :be_never_called
+ must_be.never_called
end
else
args.shift
end
@@ -57,11 +57,11 @@
tmp = args[0..-1]
args.clear
tmp
end
else
- should! :be_never_called
+ must_be.never_called
end
else
args.shift
end
@@ -71,15 +71,15 @@
a
end
def hash args, block, options, index, last
a = object(args, block, options, index, last) || {}
- a.should! :be_a, Hash
+ a.must_be.a Hash
a
end
def _common_options a, options
- a.should_not! :be_nil if options[:require]
+ a.must_not_be.nil if options[:require]
if (default = options[:default]) and a.eql?(nil)
a = default
end
a
end
\ No newline at end of file