Sha256: 42b9445d3d83b09cbbe8b56e3acf72490f92dc49ddc185b264b38e3f27288c79

Contents?: true

Size: 297 Bytes

Versions: 10

Compression:

Stored size: 297 Bytes

Contents

unless String.public_instance_methods.include? :strip_heredoc
  String.class_exec do # self is set to the String class
    def strip_heredoc
      leading_space = scan(/^[ \t]*(?=\S)/).min
      indent = leading_space ? leading_space.size : 0
      gsub(/^[ \t]{#{indent}}/, '')
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
radius-toolbelt-0.0.10 spec/support/string.rb
radius-toolbelt-0.0.9 spec/support/string.rb
radius-toolbelt-0.0.8 spec/support/string.rb
radius-toolbelt-0.0.7 spec/support/string.rb
radius-toolbelt-0.0.6 spec/support/string.rb
radius-toolbelt-0.0.5 spec/support/string.rb
radius-toolbelt-0.0.4 spec/support/string.rb
radius-toolbelt-0.0.3 spec/support/string.rb
radius-toolbelt-0.0.2 spec/support/string.rb
radius-toolbelt-0.0.1 spec/support/string.rb