Module: Stringer
- Defined in:
- lib/stringer.rb,
lib/stringer/version.rb
Defined Under Namespace
Classes: Error
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
- .minify(string, number) ⇒ Object
- .removify(string, remove_word) ⇒ Object
- .replacify(string, target_string, replacement_string) ⇒ Object
-
.spacify(*strings) ⇒ Object
Your code goes here…
- .tokenize(string) ⇒ Object
Class Method Details
.minify(string, number) ⇒ Object
16 17 18 |
# File 'lib/stringer.rb', line 16 def self.minify string, number string.length > number ? "#{string[0...number]}..." : string end |
.removify(string, remove_word) ⇒ Object
28 29 30 |
# File 'lib/stringer.rb', line 28 def self.removify string, remove_word string.gsub(remove_word, " ").split.join(" ") end |
.replacify(string, target_string, replacement_string) ⇒ Object
20 21 22 |
# File 'lib/stringer.rb', line 20 def self.replacify string, target_string, replacement_string string.sub(target_string, replacement_string) end |
.spacify(*strings) ⇒ Object
Your code goes here…
8 9 10 11 12 13 14 |
# File 'lib/stringer.rb', line 8 def self.spacify *strings string = "" strings.each do |s| string += s + " " end string.strip end |
.tokenize(string) ⇒ Object
24 25 26 |
# File 'lib/stringer.rb', line 24 def self.tokenize string string.split end |