Class: Numeric
Overview
Numeric extensions
Instance Method Summary collapse
-
#if(flag) ⇒ Object
0 if the given flag is any of: nil, false, 0, [], {}.
-
#unless(flag) ⇒ Object
Self if flag is nil, false, 0, [], {}; otherwise return 0.
Instance Method Details
#if(flag) ⇒ Object
Returns 0 if the given flag is any of: nil, false, 0, [], {}.
15 16 17 |
# File 'lib/webget_ruby_ramp/numeric.rb', line 15 def if(flag) if [nil,false,0,[],{}].include?(flag) then 0 else self end end |
#unless(flag) ⇒ Object
Returns self if flag is nil, false, 0, [], {}; otherwise return 0.
26 27 28 |
# File 'lib/webget_ruby_ramp/numeric.rb', line 26 def unless(flag) if [nil,false,0,[],{}].include?(flag) then self else 0 end end |