Class: Ownlan::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/ownlan/application.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Application

Returns a new instance of Application.



6
7
8
9
10
11
12
13
14
# File 'lib/ownlan/application.rb', line 6

def initialize(options)
  @raw_options = options

  @config = ::Ownlan.config.dup

  @config_options = raw_options.reject{ |k, v| k.to_s.match('_given') || !v }

  set_options
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



4
5
6
# File 'lib/ownlan/application.rb', line 4

def config
  @config
end

#config_optionsObject (readonly)

Returns the value of attribute config_options.



4
5
6
# File 'lib/ownlan/application.rb', line 4

def config_options
  @config_options
end

#raw_optionsObject (readonly)

Returns the value of attribute raw_options.



4
5
6
# File 'lib/ownlan/application.rb', line 4

def raw_options
  @raw_options
end

Instance Method Details

#callObject



16
17
18
19
20
21
22
# File 'lib/ownlan/application.rb', line 16

def call
  action = config.modes.find do |type, modes|
    modes.find { |mode| process(type, mode) }
  end

  show_menu unless action
end