Sha256: 15dcf85c36be5428c46f57c3f8369491a418dc564891fab9eba240e50c005d74
Contents?: true
Size: 500 Bytes
Versions: 3
Compression:
Stored size: 500 Bytes
Contents
module Reality module Util # Description is just a String subclass with rewritten `inspect` # implementation (useful in `irb`/`pry`). # class Description < String alias_method :inspect, :to_s def initialize(str) super(str.to_s.gsub(/ +\n/, "\n")) end # @private def indent(indentation = ' ') gsub(/(\A|\n)/, '\1' + indentation) end # @private def +(other) self.class.new(super) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reality-0.1.0.alpha3 | lib/reality/util/description.rb |
reality-0.1.0.alpha2 | lib/reality/util/description.rb |
reality-0.1.0.alpha | lib/reality/util/description.rb |