Class: Integer
- Inherits:
-
Object
- Object
- Integer
- Defined in:
- lib/strobogrammatic.rb
Instance Method Summary collapse
Instance Method Details
#strobogrammatic? ⇒ Boolean
16 17 18 19 20 21 |
# File 'lib/strobogrammatic.rb', line 16 def strobogrammatic? midpoint = (to_s.length / 2.0).ceil to_s[0...midpoint].split(//).each_with_index.map do |char, index| Strobogrammatic::strobogrammatic_pair?(char, to_s.reverse[index,1]) end.all? end |