Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/fedux_org_stdlib/core_ext/string/underline.rb,
lib/fedux_org_stdlib/core_ext/string.rb,
lib/fedux_org_stdlib/core_ext/string/characterize.rb
Overview
String
Instance Method Summary collapse
-
#characterize ⇒ Object
Convert string to characters only.
-
#underline(character: '-') ⇒ String
Underline a string.
Instance Method Details
#characterize ⇒ Object
Convert string to characters only
This will remove accents and umlauts and other special characters
‘ä’.characterize #=> ‘a’
15 16 17 |
# File 'lib/fedux_org_stdlib/core_ext/string/characterize.rb', line 15 def characterize ActiveSupport::Inflector.transliterate(self).parameterize end |
#underline(character: '-') ⇒ String
Underline a string
11 12 13 14 15 16 17 |
# File 'lib/fedux_org_stdlib/core_ext/string/underline.rb', line 11 def underline(character: '-') result = [] result << self result << gsub(/./, character) result.join("\n") end |