Class: String

Inherits:
Object show all
Defined in:
vendor/bundler/ruby/2.5.0/bundler/gems/sxp.rb-77c5073a7739/lib/sxp/writer.rb,
vendor/bundler/ruby/2.5.0/bundler/gems/rdf-rdfa-64ca6c8311da/lib/rdf/rdfa/patches/string_hacks.rb

Overview

Extensions for Ruby's String class.

Instance Method Summary collapse

Instance Method Details

#align_leftObject

Trim beginning of each line by the amount of indentation in the first line



3
4
5
6
7
8
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-rdfa-64ca6c8311da/lib/rdf/rdfa/patches/string_hacks.rb', line 3

def align_left
  str = self.sub(/^\s*$/, '')  # Remove leading newline
  str = str[1..-1] if str[0,1] == "\n"
  ws = str.match(/^(\s*)\S/m) ? $1 : ''
  str.gsub(/^#{ws}/m, '')
end

#to_sxpString

Returns the SXP representation of this object.

Returns:



60
61
62
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/sxp.rb-77c5073a7739/lib/sxp/writer.rb', line 60

def to_sxp
  inspect
end