module SpiritHands::Print

Constants

Public Class Methods

hirb_unicode_enabled?() click to toggle source
# File lib/spirit_hands/print.rb, line 24
def hirb_unicode_enabled?
  ::Hirb::Formatter.dynamic_config.keys.any? do |key|
    if opts = ::Hirb::Formatter.dynamic_config[key][:options]
      opts && opts[:unicode]
    end
  end
end
install!() click to toggle source
# File lib/spirit_hands/print.rb, line 10
def install!
  ::Pry.config.print = PRINT_FUNCTION
end
pretty(value) click to toggle source
# File lib/spirit_hands/print.rb, line 14
def pretty(value)
  if ::SpiritHands.awesome_print
    opts = { :indent => ::SpiritHands.value_indent }
    opts[:plain] = true if !SpiritHands.color
    value.ai(opts)
  else
    value.inspect
  end
end
print(_output, value, _pry_) click to toggle source

Private Class Methods

hirb_unicode_disable() click to toggle source
# File lib/spirit_hands/print.rb, line 56
def hirb_unicode_disable
  ::Hirb::Formatter.dynamic_config.keys.each do |key|
    ::Hirb::Formatter.dynamic_config[key][:options] ||= {}
    ::Hirb::Formatter.dynamic_config[key][:options][:unicode] = false
  end
  false
end
hirb_unicode_enable() click to toggle source
# File lib/spirit_hands/print.rb, line 45
def hirb_unicode_enable
  return false unless ::SpiritHands::Terminal.unicode?
  require 'hirb/unicode'

  ::Hirb::Formatter.dynamic_config.keys.each do |key|
    ::Hirb::Formatter.dynamic_config[key][:options] ||= {}
    ::Hirb::Formatter.dynamic_config[key][:options][:unicode] = true
  end
  true
end
setup_hirb_unicode() click to toggle source
# File lib/spirit_hands/print.rb, line 64
def setup_hirb_unicode
  if hirb_unicode_enabled? != SpiritHands.hirb_unicode
    if SpiritHands.hirb_unicode
      hirb_unicode_enable
    else
      hirb_unicode_disable
    end
  end
  nil
end