# encoding: utf-8 module Filegen # Commandline parser class Options private attr_reader :params public # Create commandline parser # # @param [Array] argv # The array which contains the commandline arguments def initialize(argv) @params = parse_options(argv) validate_params end # Source template # # @return [File] # Returns a file handle for the template def source File.new(params.template) end # Destination for output # # @return [IO] # Returns a file handle for the output def destination $stdout end # The data sources which can be used # # @return [Array] # An array of data sources which can be used def data_sources DataSourceBuilder.new(params).sources end private def validate_params validate_source end # rubocop:disable MethodLength def parse_options(argv) params = OpenStruct.new parser = OptionParser.new parser.banner = 'Usage: filegen [options]