Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/numeric.rb
Instance Method Summary collapse
- #complex? ⇒ Boolean
- #decimal? ⇒ Boolean
- #float? ⇒ Boolean
- #integer? ⇒ Boolean
- #numeric? ⇒ Boolean
- #rational? ⇒ Boolean
Instance Method Details
#complex? ⇒ Boolean
10 11 12 |
# File 'lib/numeric.rb', line 10 def complex? !!Complex(self) rescue false end |
#decimal? ⇒ Boolean
26 27 28 |
# File 'lib/numeric.rb', line 26 def decimal? !!BigDecimal(self) rescue false end |
#float? ⇒ Boolean
22 23 24 |
# File 'lib/numeric.rb', line 22 def float? !!Float(self) rescue false end |
#integer? ⇒ Boolean
18 19 20 |
# File 'lib/numeric.rb', line 18 def integer? !!Integer(self) rescue false end |
#numeric? ⇒ Boolean
6 7 8 |
# File 'lib/numeric.rb', line 6 def numeric? complex? end |
#rational? ⇒ Boolean
14 15 16 |
# File 'lib/numeric.rb', line 14 def rational? !!Rational(self) rescue false end |