lib/rbbt/util/simpleopt/parse.rb in rbbt-util-5.6.13 vs lib/rbbt/util/simpleopt/parse.rb in rbbt-util-5.6.14
- old
+ new
@@ -5,17 +5,17 @@
chars = long.chars.to_a
current = [chars.shift]
short = current * ""
- if shortcuts.include? short and long.index "-" or long.index "_"
+ if (shortcuts.include?(short) and not shortcuts[short] == long) and long.index "-" or long.index "_"
parts = long.split(/[_-]/)
acc = parts.collect{|s| s[0] } * ""
return acc unless shortcuts.include? acc
end
- while shortcuts.include? short
- while shortcuts[short].index current * ""
+ while shortcuts.include?(short) and not shortcuts[short] == long
+ while (long.length - current.length > 2) and shortcuts[short].index current * ""
next_letter = chars.shift
return nil if next_letter.nil?
current << next_letter
end
short = current * ""