Sha256: 8514e5a4ed26c15b5fd44c0b1439ed83d654294ba59a8045cde50f839c75d76b

Contents?: true

Size: 450 Bytes

Versions: 9

Compression:

Stored size: 450 Bytes

Contents

# frozen_string_literal: true

require "rainbow"
require "terminal-table"

# Define methods to trasnforme Code object into String
module CodeStringFormatter
  def self.to_s(code)
    t = Terminal::Table.new
    msg = Rainbow(code.filename).white.bg(:blue).bright
    t.add_row [Rainbow("Code").bright, msg]
    t.add_row [Rainbow("Type").blue, code.type.to_s]
    t.add_row [Rainbow("Lines").blue, code.lines_to_s(code.lines)]
    "#{t}\n"
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
asker-tool-2.9.4 lib/asker/formatter/code_string_formatter.rb
asker-tool-2.9.3 lib/asker/formatter/code_string_formatter.rb
asker-tool-2.9.2 lib/asker/formatter/code_string_formatter.rb
asker-tool-2.9.1 lib/asker/formatter/code_string_formatter.rb
asker-tool-2.9.0 lib/asker/formatter/code_string_formatter.rb
asker-tool-2.8.0 lib/asker/formatter/code_string_formatter.rb
asker-tool-2.7.2 lib/asker/formatter/code_string_formatter.rb
asker-tool-2.7.1 lib/asker/formatter/code_string_formatter.rb
asker-tool-2.7.0 lib/asker/formatter/code_string_formatter.rb