Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/manifestly/utilities.rb
Constant Summary collapse
- BLANK_RE =
/\A[[:space:]]*\z/
Instance Method Summary collapse
Instance Method Details
#blank? ⇒ Boolean
23 24 25 |
# File 'lib/manifestly/utilities.rb', line 23 def blank? BLANK_RE === self end |
#is_i? ⇒ Boolean
17 18 19 |
# File 'lib/manifestly/utilities.rb', line 17 def is_i? !!(self =~ /\A[-+]?[0-9]+\z/) end |
#starts_with?(prefix) ⇒ Boolean
27 28 29 |
# File 'lib/manifestly/utilities.rb', line 27 def starts_with?(prefix) prefix.respond_to?(:to_str) && self[0, prefix.length] == prefix end |
#wrap(width = 78) ⇒ Object
31 32 33 |
# File 'lib/manifestly/utilities.rb', line 31 def wrap(width=78) gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n") end |