Module: Montage::Support
- Included in:
- Query, QueryParser
- Defined in:
- lib/montage/support.rb
Instance Method Summary collapse
-
#is_f?(value) ⇒ Boolean
Determines if the string value passed in is a float Returns true or false.
-
#is_i?(value) ⇒ Boolean
Determines if the string value passed in is an integer Returns true or false.
-
#nillify(value) ⇒ Object
Will take either an empty string or zero and turn it into a nil object If the value passed in is neither zero or an empty string, will return the value.
Instance Method Details
#is_f?(value) ⇒ Boolean
Determines if the string value passed in is a float Returns true or false
21 22 23 |
# File 'lib/montage/support.rb', line 21 def is_f?(value) /\A\d+\.\d+\z/ === value end |
#is_i?(value) ⇒ Boolean
Determines if the string value passed in is an integer Returns true or false
14 15 16 |
# File 'lib/montage/support.rb', line 14 def is_i?(value) /\A\d+\z/ === value end |
#nillify(value) ⇒ Object
Will take either an empty string or zero and turn it into a nil object If the value passed in is neither zero or an empty string, will return the value
6 7 8 9 |
# File 'lib/montage/support.rb', line 6 def nillify(value) return value unless ["", 0].include?(value) nil end |