Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/oh_my_method/string.rb
Instance Method Summary collapse
Instance Method Details
#middle_with?(str) ⇒ Boolean
6 7 8 |
# File 'lib/oh_my_method/string.rb', line 6 def middle_with?(str) (self =~ /.+#{str}.+/)? true : false end |
#palindrome? ⇒ Boolean
2 3 4 |
# File 'lib/oh_my_method/string.rb', line 2 def palindrome? self == self.reverse end |
#sum_digit ⇒ Object
10 11 12 |
# File 'lib/oh_my_method/string.rb', line 10 def sum_digit self.chars.map(&:to_i).inject(:+) end |