Module: Icepick

Defined in:
lib/icepick.rb,
lib/icepick/config.rb,
lib/icepick/prompt.rb,
lib/icepick/railtie.rb,
lib/icepick/version.rb

Defined Under Namespace

Classes: Config, Prompt, Railtie

Constant Summary collapse

AWESOME_OPTS =

AwesomePrint configuration options

{
  indent:     2,
  sort_keys:  true
}
VERSION =
'0.2.0'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.initialize!(name = nil) ⇒ Object

Public: Setup and initialize Icepick

options - Options to use in setup (defaults: {})

* name: A name to use for the prompt

Returns nothing



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/icepick.rb', line 33

def self.initialize!(name = nil)
  silence_warnings do
    # Set the prompt name, for the Railtie this is the application name
    Prompt.config.name = name if name

    # Use awesome_print for Pry output
    Pry.config.print = ->(output, value) do
      pretty = value.ai(AWESOME_OPTS)
      Pry::Helpers::BaseHelpers.stagger_output("=> #{pretty}", output)
    end

    # Use Icepick's Prompt for Pry
    Pry.config.prompt = [Prompt.main_prompt, Prompt.wait_prompt]

    # Debugger shortcuts
    if defined?(PryDebugger)
      Pry.commands.alias_command 'c', 'continue'
      Pry.commands.alias_command 's', 'step'
      Pry.commands.alias_command 'n', 'next'
      Pry.commands.alias_command 'f', 'finish'
    end
  end
end

Instance Method Details

#initializeObject

Public: Prohibit the instantiation of Icepick

Raises NotImplementedError

Raises:

  • (NotImplementedError)


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

def initialize
  raise NotImplementedError
end