Class: Charyf::Console

Inherits:
Object show all
Defined in:
lib/charyf/utils/commands/console/console_command.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ Console



16
17
18
19
20
21
# File 'lib/charyf/utils/commands/console/console_command.rb', line 16

def initialize(app, options = {})
  @app     = app
  @options = options

  @console = app.config.console || IRB
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



14
15
16
# File 'lib/charyf/utils/commands/console/console_command.rb', line 14

def app
  @app
end

#consoleObject (readonly)

Returns the value of attribute console.



14
15
16
# File 'lib/charyf/utils/commands/console/console_command.rb', line 14

def console
  @console
end

#optionsObject (readonly)

Returns the value of attribute options.



14
15
16
# File 'lib/charyf/utils/commands/console/console_command.rb', line 14

def options
  @options
end

Class Method Details

.start(*args) ⇒ Object



10
11
12
# File 'lib/charyf/utils/commands/console/console_command.rb', line 10

def self.start(*args)
  new(*args).start
end

Instance Method Details

#environmentObject Also known as: environment?



23
24
25
# File 'lib/charyf/utils/commands/console/console_command.rb', line 23

def environment
  options[:environment]
end

#set_environment!Object



29
30
31
# File 'lib/charyf/utils/commands/console/console_command.rb', line 29

def set_environment!
  Charyf.env = environment
end

#startObject



33
34
35
36
37
38
39
# File 'lib/charyf/utils/commands/console/console_command.rb', line 33

def start
  set_environment! if environment?

  puts "Loading #{Charyf.env} environment (Charyf #{Charyf.version})"

  console.start
end