Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/rake/helpers/string.rb
Overview
extend class String with a ‘prepend` method
Instance Method Summary collapse
- #dos2unix_separator ⇒ Object
- #dos2unix_separator! ⇒ Object
- #double_delimiters ⇒ Object
- #double_delimiters! ⇒ Object
- #prepend(value) ⇒ Object
- #starts_with?(prefix) ⇒ Boolean
- #unix2dos_separator ⇒ Object
- #unix2dos_separator! ⇒ Object
Instance Method Details
#dos2unix_separator ⇒ Object
24 25 26 |
# File 'lib/rake/helpers/string.rb', line 24 def dos2unix_separator gsub('\\', '/') end |
#dos2unix_separator! ⇒ Object
32 33 34 |
# File 'lib/rake/helpers/string.rb', line 32 def dos2unix_separator! replace(self.dos2unix_separator) end |
#double_delimiters ⇒ Object
16 17 18 |
# File 'lib/rake/helpers/string.rb', line 16 def double_delimiters gsub('\\', '\\\\\\') end |
#double_delimiters! ⇒ Object
20 21 22 |
# File 'lib/rake/helpers/string.rb', line 20 def double_delimiters! replace(self.double_delimiters) end |
#prepend(value) ⇒ Object
6 7 8 |
# File 'lib/rake/helpers/string.rb', line 6 def prepend(value) insert(0, value) end |
#starts_with?(prefix) ⇒ Boolean
11 12 13 14 |
# File 'lib/rake/helpers/string.rb', line 11 def starts_with?(prefix) prefix = prefix.to_s self[0, prefix.length] == prefix end |
#unix2dos_separator ⇒ Object
28 29 30 |
# File 'lib/rake/helpers/string.rb', line 28 def unix2dos_separator gsub('/', '\\') end |
#unix2dos_separator! ⇒ Object
36 37 38 |
# File 'lib/rake/helpers/string.rb', line 36 def unix2dos_separator! replace(self.unix2dos_separator) end |