Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/core_ext/string.rb

Overview

Archetype extensions for String

Instance Method Summary collapse

Instance Method Details

#camel_case(str = nil) ⇒ String

Converts a string to camel case

Returns:



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

Returns:



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

Returns:



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

Returns:



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

Returns:



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

Returns:



10
11
12
13
# File 'lib/core_ext/string.rb', line 10

def snake_case(str = nil)
  str ||= self
  helper.snake_case(str)
end