Class: Lucie::App

Inherits:
Object
  • Object
show all
Defined in:
lib/lucie/app.rb

Constant Summary collapse

@@raise_exception =
false
@@log_level =
:info

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, root) ⇒ App

Returns a new instance of App.



13
14
15
16
17
18
# File 'lib/lucie/app.rb', line 13

def initialize(command, root)
  self.root = root || File.expand_path("..", File.dirname(Kernel.caller[2]))
  self.command = command
  @exit_value ||= 0
  @task = nil
end

Class Attribute Details

.log_levelObject

Returns the value of attribute log_level.



30
31
32
# File 'lib/lucie/app.rb', line 30

def log_level
  @log_level
end

.raise_exceptionObject

Returns the value of attribute raise_exception.



29
30
31
# File 'lib/lucie/app.rb', line 29

def raise_exception
  @raise_exception
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



4
5
6
# File 'lib/lucie/app.rb', line 4

def command
  @command
end

#rootObject

Returns the value of attribute root.



5
6
7
# File 'lib/lucie/app.rb', line 5

def root
  @root
end

Class Method Details

.run(command = ARGV, root = nil) ⇒ Object



7
8
9
10
11
# File 'lib/lucie/app.rb', line 7

def self.run(command = ARGV, root = nil)
  obj = self.new(command, root)
  obj.start
  obj.exit_value
end

Instance Method Details

#exit_valueObject



24
25
26
# File 'lib/lucie/app.rb', line 24

def exit_value
  @exit_value
end

#startObject



20
21
22
# File 'lib/lucie/app.rb', line 20

def start
  help? ? call_help : call_method_invoking_process
end