Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/core_ext.rb
Constant Summary collapse
- BLANK_RE =
/\A[[:space:]]*\z/
Instance Method Summary collapse
- #blank? ⇒ Boolean
- #enquote ⇒ Object
- #indent(spaces = 2) ⇒ Object
- #inline_dcm ⇒ Object
- #to_regexp(ignorecase: false, multiline: false, extended: false) ⇒ Object
Instance Method Details
#blank? ⇒ Boolean
4 5 6 |
# File 'lib/core_ext.rb', line 4 def blank? empty? || BLANK_RE === self || self == "\u001A" end |
#enquote ⇒ Object
16 17 18 |
# File 'lib/core_ext.rb', line 16 def enquote "\"#{to_s}\"" end |
#indent(spaces = 2) ⇒ Object
8 9 10 |
# File 'lib/core_ext.rb', line 8 def indent(spaces = 2) lines.map { |line| " " * spaces + line }.join end |
#inline_dcm ⇒ Object
12 13 14 |
# File 'lib/core_ext.rb', line 12 def inline_dcm "KONSERVIERUNG_FORMAT 2.0\n\n" + self end |
#to_regexp(ignorecase: false, multiline: false, extended: false) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/core_ext.rb', line 20 def to_regexp(ignorecase: false, multiline: false, extended: false) = 0 = | Regexp::EXTENDED if extended = | Regexp::IGNORECASE if ignorecase = | Regexp::MULTILINE if multiline Regexp.new(self, ) end |