summaryrefslogtreecommitdiff
path: root/lib/slop/option.rb
diff options
context:
space:
mode:
authorLee Jarvis <ljjarvis@gmail.com>2013-01-13 18:45:20 +0000
committerLee Jarvis <ljjarvis@gmail.com>2013-01-13 18:45:20 +0000
commitedddf1a35ccea52dc559ddd40590cb5b66dd8d5c (patch)
tree37f76945877baf12b836d44eaab10867c679a5bb /lib/slop/option.rb
parent6e4d2b6ca6c5a20e8265c857422f7e7febd33e97 (diff)
downloadslop-edddf1a35ccea52dc559ddd40590cb5b66dd8d5c.tar.gz
ensure Object#eql? checks against short and long flags
Diffstat (limited to 'lib/slop/option.rb')
-rw-r--r--lib/slop/option.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/slop/option.rb b/lib/slop/option.rb
index c63fd1a..0e92e76 100644
--- a/lib/slop/option.rb
+++ b/lib/slop/option.rb
@@ -122,6 +122,14 @@ class Slop
end
end
+ def eql?(other)
+ short and short == other.short or long and long == other.long
+ end
+
+ def hash
+ [short, long].hash
+ end
+
# Returns the help String for this option.
def to_s
return config[:help] if config[:help].respond_to?(:to_str)