summaryrefslogtreecommitdiff
path: root/lib/slop/option.rb
diff options
context:
space:
mode:
authorLee Jarvis <lee@jarvis.co>2012-01-28 15:52:41 +0000
committerLee Jarvis <lee@jarvis.co>2012-01-28 15:52:41 +0000
commitadc8a315b0c32fe258a7805592b03171fd806fe6 (patch)
tree3459169ab7f967e7fdc02981dbca4cfdfd3271ec /lib/slop/option.rb
parentc2e809873fb82600de7a349a0a989c6671309f3a (diff)
downloadslop-adc8a315b0c32fe258a7805592b03171fd806fe6.tar.gz
added Slop#strict? method
Diffstat (limited to 'lib/slop/option.rb')
-rw-r--r--lib/slop/option.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/slop/option.rb b/lib/slop/option.rb
index fc02387..676c330 100644
--- a/lib/slop/option.rb
+++ b/lib/slop/option.rb
@@ -135,7 +135,7 @@ class Slop
#
# Returns the Integer value if possible to convert, else a zero.
def value_to_integer(value)
- if @slop.config[:strict]
+ if @slop.strict?
begin
Integer(value.to_s, 10)
rescue ArgumentError
@@ -153,7 +153,7 @@ class Slop
#
# Returns the Float value if possible to convert, else a zero.
def value_to_float(value)
- if @slop.config[:strict]
+ if @slop.strict?
begin
Float(value.to_s)
rescue ArgumentError
@@ -176,7 +176,7 @@ class Slop
when /\A(-?\d+?)(\.\.\.?|-|,)(-?\d+)\z/
Range.new($1.to_i, $3.to_i, $2 == '...')
else
- if @slop.config[:strict]
+ if @slop.strict?
raise InvalidArgumentError, "#{value} could not be coerced into Range"
else
value