Class: Inch::CLI::Command::Output::Console

Inherits:
Base
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/inch/cli/command/output/console.rb

Constant Summary collapse

COLOR =

magenta-ish

:color198
BG_COLOR =

magenta-ish

:color207

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#print_file_info, #priority_arrow, #ui

Methods included from TraceHelper

#ui

Constructor Details

#initialize(options, object, objects, codebase) ⇒ Console

Returns a new instance of Console

Parameters:



17
18
19
20
21
22
23
24
# File 'lib/inch/cli/command/output/console.rb', line 17

def initialize(options, object, objects, codebase)
  @options = options
  @object = object
  @objects = objects
  @codebase = codebase

  run
end

Instance Attribute Details

#codebaseObject (readonly)

Returns the value of attribute codebase



8
9
10
# File 'lib/inch/cli/command/output/console.rb', line 8

def codebase
  @codebase
end

#objectObject (readonly) Also known as: o

Returns the value of attribute object



8
9
10
# File 'lib/inch/cli/command/output/console.rb', line 8

def object
  @object
end

#objectsObject (readonly)

Returns the value of attribute objects



8
9
10
# File 'lib/inch/cli/command/output/console.rb', line 8

def objects
  @objects
end

Instance Method Details

#all_objectsObject Also known as: all



26
27
28
# File 'lib/inch/cli/command/output/console.rb', line 26

def all_objects
  @codebase.objects.all
end

#find_object(fullname) ⇒ Object Also known as: f



34
35
36
# File 'lib/inch/cli/command/output/console.rb', line 34

def find_object(fullname)
  @codebase.objects.find(fullname)
end

#find_objects(fullname) ⇒ Object Also known as: ff



30
31
32
# File 'lib/inch/cli/command/output/console.rb', line 30

def find_objects(fullname)
  @codebase.objects.starting_with(fullname)
end

#runObject



43
44
45
46
47
48
49
50
51
# File 'lib/inch/cli/command/output/console.rb', line 43

def run
  ui.trace
  ui.header("Welcome to Inch's console", COLOR, BG_COLOR)
  ui.sub @options.usage
  @options.descriptions.each do |line|
    ui.sub line
  end
  run_pry
end

#run_pryObject



53
54
55
# File 'lib/inch/cli/command/output/console.rb', line 53

def run_pry
  binding.pry
end