Class: Alf::Shell::Main

Inherits:
Object
  • Object
show all
Includes:
Support
Defined in:
lib/alf/shell/command/main.rb

Constant Summary

Constants included from Support

Support::AlfFile

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Support

#operand, #show_help

Constructor Details

#initialize(config = load_config) ⇒ Main

Creates a command instance



7
8
9
# File 'lib/alf/shell/command/main.rb', line 7

def initialize(config = load_config)
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



10
11
12
# File 'lib/alf/shell/command/main.rb', line 10

def config
  @config
end

Instance Method Details

#connectionObject

Alf’s options



68
69
70
# File 'lib/alf/shell/command/main.rb', line 68

def connection
  @connection ||= config.database.connection(viewpoint: build_viewpoint)
end

#execute(argv) ⇒ Object



72
73
74
75
76
77
78
79
80
# File 'lib/alf/shell/command/main.rb', line 72

def execute(argv)
  install_load_path
  install_requires

  # compile the operator, render and returns it
  super.tap do |op|
    render(connection.relvar(op)) if op && requester
  end
end