summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Fitzgerald <netzdamon@gmail.com>2010-12-03 19:23:32 -0500
committerGreg Fitzgerald <netzdamon@gmail.com>2010-12-03 19:23:32 -0500
commitb1b76be7272853aecb84d948379d59dbfff426fc (patch)
tree44cc49986b09e4c677ffa2a060de935ffabd247c
parent96d513763219043900ba35db3eca3e25a435d170 (diff)
downloadslop-b1b76be7272853aecb84d948379d59dbfff426fc.tar.gz
Fix typo in options_hash
-rw-r--r--lib/slop.rb4
-rw-r--r--spec/slop_spec.rb8
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/slop.rb b/lib/slop.rb
index d1e710e..e83d82e 100644
--- a/lib/slop.rb
+++ b/lib/slop.rb
@@ -106,7 +106,7 @@ class Slop
# @return [Hash]
def options_hash
out = {}
- each_option do |opt|
+ options.each do |opt|
if opt.requires_argument? or opt.has_default?
out[opt.key] = opt.argument_value || opt.default
end
@@ -155,4 +155,4 @@ class Slop
return unless flag
flag[1, 2].include?('-')
end
-end \ No newline at end of file
+end
diff --git a/spec/slop_spec.rb b/spec/slop_spec.rb
index 42b9658..bacd686 100644
--- a/spec/slop_spec.rb
+++ b/spec/slop_spec.rb
@@ -44,6 +44,12 @@ describe Slop do
end
end
+ describe "options_hash" do
+ it "returns a hash" do
+ @slop.options_hash.should be_kind_of(Hash)
+ end
+ end
+
describe "option_for" do
it "returns an option" do
@slop.option_for(:v).should be_kind_of(Slop::Option)
@@ -110,4 +116,4 @@ describe Slop do
end
end
-end \ No newline at end of file
+end