Class: AsciiDataTools::Controller::AbstractController

Inherits:
Object
  • Object
show all
Defined in:
lib/ascii-data-tools/controller.rb

Instance Method Summary collapse

Constructor Details

#initialize(configuration_or_command_line_arguments) ⇒ AbstractController

Returns a new instance of AbstractController.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ascii-data-tools/controller.rb', line 8

def initialize(configuration_or_command_line_arguments)
  case configuration_or_command_line_arguments
  when Hash then
    @configuration = Configuration.new([], defaults.merge(configuration_or_command_line_arguments))
  when Array then
    @configuration = Configuration.new(configuration_or_command_line_arguments, defaults)
  when Configuration then
    @configuration = configuration_or_command_line_arguments
  end
  @configuration.error_info_with_usage unless @configuration.valid?
end

Instance Method Details

#runObject



24
25
26
# File 'lib/ascii-data-tools/controller.rb', line 24

def run
  raise "should be implemented!"
end

#type_determinerObject



20
21
22
# File 'lib/ascii-data-tools/controller.rb', line 20

def type_determiner
  @type_determiner ||= RecordType::TypeDeterminer.new(@configuration.record_types)
end