Class: Filegen::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/filegen/options.rb

Overview

Commandline parser

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Options

Create commandline parser

Parameters:

  • argv (Array)

    The array which contains the commandline arguments



15
16
17
18
19
# File 'lib/filegen/options.rb', line 15

def initialize(argv)
  @params = parse_options(argv)

  validate_params
end

Instance Method Details

#data_sourcesArray

The data sources which can be used

Returns:

  • (Array)

    An array of data sources which can be used



41
42
43
# File 'lib/filegen/options.rb', line 41

def data_sources
  DataSourceBuilder.new(params).sources
end

#destinationIO

Destination for output

Returns:

  • (IO)

    Returns a file handle for the output



33
34
35
# File 'lib/filegen/options.rb', line 33

def destination
  $stdout
end

#sourceFile

Source template

Returns:

  • (File)

    Returns a file handle for the template



25
26
27
# File 'lib/filegen/options.rb', line 25

def source
  File.new(params.template)
end