Module: JazzFingers

Extended by:
Forwardable
Defined in:
lib/jazz_fingers.rb,
lib/jazz_fingers/input.rb,
lib/jazz_fingers/print.rb,
lib/jazz_fingers/prompt.rb,
lib/jazz_fingers/coderay.rb,
lib/jazz_fingers/version.rb,
lib/jazz_fingers/commands.rb,
lib/jazz_fingers/commands/sql.rb,
lib/jazz_fingers/amazing_print.rb,
lib/jazz_fingers/commands/copy.rb,
lib/jazz_fingers/configuration.rb,
lib/jazz_fingers/coderay/escaped_colors.rb,
lib/jazz_fingers/commands/caller_method.rb,
lib/jazz_fingers/coderay/unescaped_colors.rb,
lib/jazz_fingers/prompt/pry_version_012_and_prior.rb,
lib/jazz_fingers/prompt/pry_version_013_and_later.rb

Defined Under Namespace

Modules: CodeRay, Commands Classes: Configuration, Input, Print, Prompt

Constant Summary collapse

VERSION =
'6.2.0'.freeze
AMAZING_PRINT =
{
  indent: 2,
  sort_keys: true,
  color: {
    args: :greenish,
    array: :whiteish,
    bigdecimal: :blue,
    class: :yellow,
    date: :greenish,
    falseclass: :red,
    fixnum: :blue,
    float: :blue,
    hash: :whiteish,
    keyword: :cyan,
    method: :purpleish,
    nilclass: :red,
    string: :yellowish,
    struct: :whiteish,
    symbol: :cyanish,
    time: :greenish,
    trueclass: :green,
    variable: :cyanish
  }
}

Class Method Summary collapse

Class Method Details

.configObject



46
47
48
# File 'lib/jazz_fingers.rb', line 46

def config
  @config ||= Configuration.new
end

.configure {|@config ||= Configuration.new| ... } ⇒ Object

Yields:



41
42
43
44
# File 'lib/jazz_fingers.rb', line 41

def configure
  yield @config ||= Configuration.new
  setup!
end

.inputObject



37
38
39
# File 'lib/jazz_fingers.rb', line 37

def input
  @input ||= Input.config
end


23
24
25
# File 'lib/jazz_fingers.rb', line 23

def print
  @print ||= Print.config
end

.promptObject



27
28
29
30
31
32
33
34
35
# File 'lib/jazz_fingers.rb', line 27

def prompt
  @prompt ||=
    Prompt.new(
      colored: config.colored_prompt,
      separator: config.prompt_separator,
      application_name: config.application_name
    )
  @prompt.config
end

.setup!Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/jazz_fingers.rb', line 50

def setup!
  Pry.prompt = prompt
  Pry.input = input if JazzFingers.coolline?
  Pry.config.should_load_plugins = false
  Pry.commands.alias_command('c', 'continue')
  Pry.commands.alias_command('s', 'step')
  Pry.commands.alias_command('n', 'next')
  Pry.editor = 'vi'
  Pry.config.ls.separator = "\n"
  Pry.config.ls.heading_color = :magenta
  Pry.config.ls.public_method_color = :green
  Pry.config.ls.protected_method_color = :yellow
  Pry.config.ls.private_method_color = :bright_black

  JazzFingers::Commands.constants(false).each do |constant|
    command = JazzFingers::Commands.const_get(constant)
    Pry.config.commands.import(command)
  end

  if JazzFingers.amazing_print?
    require 'amazing_print'

    AmazingPrint.defaults = JazzFingers::AMAZING_PRINT
    Pry.print = print
  end

  JazzFingers::CodeRay.setup!

  true
end