Class: Betterp::Output

Inherits:
Object
  • Object
show all
Defined in:
lib/betterp/output.rb

Constant Summary collapse

COLORS =
%i[red green yellow blue magenta cyan].freeze
EFFECTS =
[:bright, nil].freeze

Instance Method Summary collapse

Constructor Details

#initialize(raw, source, options = {}) ⇒ Output

Returns a new instance of Output.



8
9
10
11
12
13
14
# File 'lib/betterp/output.rb', line 8

def initialize(raw, source, options = {})
  @raw = raw
  @source = source
  @color = color
  @effect = effect
  @pretty = options.fetch(:pretty, false)
end

Instance Method Details

#format(args) ⇒ Object



16
17
18
19
20
21
# File 'lib/betterp/output.rb', line 16

def format(args)
  args.map do |arg|
    style = %i[yellow]
    header + colorize(prefix) + caller_code + Paint[pretty(arg), *style]
  end
end