Module: StringCrutch
- Defined in:
- lib/string_crutch.rb
Class Method Summary collapse
Class Method Details
.chars(str) ⇒ Object
13 14 15 |
# File 'lib/string_crutch.rb', line 13 def chars(str) str.scan(/./mu) end |
.count(str, char) ⇒ Object
5 6 7 |
# File 'lib/string_crutch.rb', line 5 def count(str, char) chars(str).select { |c| c == char }.size end |
.size(str) ⇒ Object
9 10 11 |
# File 'lib/string_crutch.rb', line 9 def size(str) chars(str).size end |