Sha256: 2dbf8b0abb6ee37378ceec055e1f7a04bc5e677aa48d3c0eb3e8abe0e8ecd2f5
Contents?: true
Size: 540 Bytes
Versions: 3
Compression:
Stored size: 540 Bytes
Contents
module Taketo module Printer def initialize @indent_level = 0 @print_result = "" end def result @print_result.chomp end private def indent(level = nil) @first_indent ||= level || @indent_level level ? @indent_level = level - @first_indent : @indent_level += 1 yield end def put(str = nil) @print_result += (" " * @indent_level + str.to_s).rstrip.chomp + "\n" end def put_optional(str, value) put "#{str} #{value}" if value end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
taketo-0.3.1 | lib/taketo/printer.rb |
taketo-0.3.0 | lib/taketo/printer.rb |
taketo-0.2.0 | lib/taketo/printer.rb |