class TLAW::Util::Description

Description is just a String subclass with rewritten `inspect` implementation (useful in `irb`/`pry`):

“`ruby str = “Description of endpoint:nIt has params:…” # “Description of endpoint:nIt has params:…”

TLAW::Util::Description.new(str) # Description of endpoint: # It has params:… “`

TLAW uses it when responds to {APIPath.describe}.

Public Class Methods

new(str) click to toggle source
Calls superclass method
# File lib/tlaw/util.rb, line 30
def initialize(str)
  super(str.to_s.gsub(/ +\n/, "\n"))
end

Public Instance Methods

+(other) click to toggle source

@private

Calls superclass method
# File lib/tlaw/util.rb, line 40
def +(other)
  self.class.new(super)
end
indent(indentation = ' ') click to toggle source

@private

# File lib/tlaw/util.rb, line 35
def indent(indentation = '  ')
  gsub(/(\A|\n)/, '\1' + indentation)
end