Class: String

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

Direct Known Subclasses

Gamefic::Ansi::Code::Nonstandard

Instance Method Summary collapse

Instance Method Details

#cap_firstString

Returns:



8
9
10
# File 'lib/gamefic/core_ext/string.rb', line 8

def cap_first
	self.capitalize_first
end

#capitalize_firstObject

Capitalize the first letter without changing the rest of the string. (String#capitalize makes the rest of the string lower-case.)



4
5
6
# File 'lib/gamefic/core_ext/string.rb', line 4

def capitalize_first
	"#{self[0,1].upcase}#{self[1,self.length]}"
end

#split_wordsArray

Returns:



12
13
14
# File 'lib/gamefic/core_ext/string.rb', line 12

def split_words
	self.gsub(/ +/, ' ').strip.split
end