Sha256: b2a6040d06eb80b5792a1e6665934134c256656ea2c0b499e453d5bb23d3349d

Contents?: true

Size: 289 Bytes

Versions: 50

Compression:

Stored size: 289 Bytes

Contents

class ::String
  # Trim beginning of each line by the amount of indentation in the first line
  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
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
rdf-rdfa-0.3.7 lib/rdf/rdfa/patches/string_hacks.rb
rdf-rdfa-0.3.6 lib/rdf/rdfa/patches/string_hacks.rb
rdf-rdfa-0.3.5.1 lib/rdf/rdfa/patches/string_hacks.rb
rdf-rdfa-0.3.4.2 lib/rdf/rdfa/patches/string_hacks.rb
rdf-rdfa-0.3.4.1 lib/rdf/rdfa/patches/string_hacks.rb
rdf-rdfa-0.3.4 lib/rdf/rdfa/patches/string_hacks.rb
rdf-rdfa-0.3.3.3 lib/rdf/rdfa/patches/string_hacks.rb
rdf-rdfa-0.3.3.2 lib/rdf/rdfa/patches/string_hacks.rb
rdf-rdfa-0.3.3.1 lib/rdf/rdfa/patches/string_hacks.rb
rdf-rdfa-0.3.3 lib/rdf/rdfa/patches/string_hacks.rb