lib/roxml/options.rb in Empact-roxml-2.4.0 vs lib/roxml/options.rb in Empact-roxml-2.4.1

- old
+ new

@@ -41,11 +41,11 @@ end def to_hash_args(args, type, name) args = [args] unless args.is_a? Array - if args.one? && !(args.only.keys & HASH_KEYS).empty? + if args.one? && !(args.first.keys & HASH_KEYS).empty? opts = {type => name} if type == :content opts[:type] = :text (opts[:as] ||= []) << :content end @@ -243,29 +243,30 @@ def extract_type(args) types = (@opts.keys & TYPE_KEYS) # type arg if args.one? && types.empty? - if args.only.is_a? Array + type = args.first + if type.is_a? Array @opts[:as] << :array - return args.only.only - elsif args.only.is_a? Hash - @opts[:hash] = args.only + return type.first + elsif type.is_a? Hash + @opts[:hash] = type return :hash else - return args.only + return type end end unless args.empty? raise ArgumentError, "too many arguments (#{(args + types).join(', ')}). Should be name, type, and " + "an options hash, with the type and options optional" end # type options if types.one? - @opts[:from] = @opts.delete(types.only) - types.only + @opts[:from] = @opts.delete(types.first) + types.first elsif types.empty? :text else raise ArgumentError, "more than one type option specified: #{types.join(', ')}" end \ No newline at end of file