Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/quick_exam/core_ext.rb
Instance Method Summary collapse
- #__blank? ⇒ Boolean
- #__presence ⇒ Object
- #__present? ⇒ Boolean
- #__squish ⇒ Object
- #__squish! ⇒ Object
Instance Method Details
#__blank? ⇒ Boolean
2 3 4 5 6 7 8 9 |
# File 'lib/quick_exam/core_ext.rb', line 2 def __blank? case self when [], '', "\n", nil, false true else false end end |
#__presence ⇒ Object
15 16 17 |
# File 'lib/quick_exam/core_ext.rb', line 15 def __presence self if __present? end |
#__present? ⇒ Boolean
11 12 13 |
# File 'lib/quick_exam/core_ext.rb', line 11 def __present? !__blank? end |
#__squish ⇒ Object
19 20 21 |
# File 'lib/quick_exam/core_ext.rb', line 19 def __squish dup.__squish! end |
#__squish! ⇒ Object
23 24 25 26 27 |
# File 'lib/quick_exam/core_ext.rb', line 23 def __squish! gsub!(/[[:space:]]+/, " ") strip! self end |