Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/core_ext/string.rb
Overview
Archetype extensions for String
Instance Method Summary collapse
-
#camel_case(str = nil) ⇒ String
Converts a string to camel case.
-
#dash_case(str = nil) ⇒ String
Converts string to dash case.
-
#pluralize(str = nil) ⇒ String
Attempts to pluralize a word.
-
#randomize(size = 5, str = nil) ⇒ String
Adds a random string of specified length at the end.
-
#singularize(str = nil) ⇒ String
Attempts to singluarize a word.
-
#snake_case(str = nil) ⇒ String
Converts string to snake case.
Instance Method Details
#camel_case(str = nil) ⇒ String
Converts a string to camel case
30 31 32 33 |
# File 'lib/core_ext/string.rb', line 30 def camel_case(str = nil) str ||= self helper.camel_case(str) end |
#dash_case(str = nil) ⇒ String
Converts string to dash case
20 21 22 23 |
# File 'lib/core_ext/string.rb', line 20 def dash_case(str = nil) str ||= self helper.dash_case(str) end |
#pluralize(str = nil) ⇒ String
Attempts to pluralize a word
40 41 42 43 |
# File 'lib/core_ext/string.rb', line 40 def pluralize(str = nil) str ||= self helper.pluralize(str) end |
#randomize(size = 5, str = nil) ⇒ String
Adds a random string of specified length at the end
60 61 62 63 |
# File 'lib/core_ext/string.rb', line 60 def randomize(size = 5, str = nil) str ||= self helper.randomize(str, size.to_s) end |
#singularize(str = nil) ⇒ String
Attempts to singluarize a word
50 51 52 53 |
# File 'lib/core_ext/string.rb', line 50 def singularize(str = nil) str ||= self helper.singularize(str) end |
#snake_case(str = nil) ⇒ String
Converts string to snake case
10 11 12 13 |
# File 'lib/core_ext/string.rb', line 10 def snake_case(str = nil) str ||= self helper.snake_case(str) end |