1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* struct.c (rb_struct_s_def): Struct::new executes block with

generated struct class. [ruby-talk:02606]

* io.c (rb_io_ungetc): raise IOError instead of calling
  rb_sys_fail().  [ruby-talk:23181]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2004-03-10 07:05:19 +00:00
parent 86e988a555
commit 7c097dc891
10 changed files with 372 additions and 111 deletions

View file

@ -34,7 +34,7 @@ class GetoptLong
# Error types.
#
class Error < StandardError; end
class AmbigousOption < Error; end
class AmbiguousOption < Error; end
class NeedlessArgument < Error; end
class MissingArgument < Error; end
class InvalidOption < Error; end
@ -208,7 +208,7 @@ class GetoptLong
end
#
# Set/Unset `quit' mode.
# Set/Unset `quiet' mode.
#
attr_writer :quiet
@ -351,16 +351,16 @@ class GetoptLong
# The option `option_name' is not registered in `@canonical_names'.
# It may be an abbreviated.
#
match_count = 0
matches = []
@canonical_names.each_key do |key|
if key.index(pattern) == 0
option_name = key
match_count += 1
matches << key
end
end
if 2 <= match_count
set_error(AmbigousOption, "option `#{argument}' is ambiguous")
elsif match_count == 0
if 2 <= matches.length
set_error(AmbiguousOption, "option `#{argument}' is ambiguous between #{matches.join(', ')}")
elsif matches.length == 0
set_error(InvalidOption, "unrecognized option `#{argument}'")
end
end