Class: String

Inherits:
Object show all
Defined in:
lib/ytrbium/core_ext.rb

Direct Known Subclasses

Ytrbium::String

Instance Method Summary collapse

Instance Method Details

#indent_by(preindent) ⇒ Object



54
55
56
57
# File 'lib/ytrbium/core_ext.rb', line 54

def indent_by(preindent)
  indent_str = " " * preindent
  lines.join(indent_str)
end

#single_line_ending_in_newline?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/ytrbium/core_ext.rb', line 59

def single_line_ending_in_newline?
  count("\n") == 1 && self[-1] == "\n"
end