Class: Betterp::Output
- Inherits:
-
Object
- Object
- Betterp::Output
- 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
- #format(args) ⇒ Object
-
#initialize(raw, source, options = {}) ⇒ Output
constructor
A new instance of Output.
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, = {}) @raw = raw @source = source @color = color @effect = effect @pretty = .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 |