Sha256: 45765271f26115afdd24447f950a7ae970cbb9d5f6df3c7b53d96633b94e0693

Contents?: true

Size: 935 Bytes

Versions: 18

Compression:

Stored size: 935 Bytes

Contents

module BeerDb

class Opts

  def merge_gli_options!( options = {} )
    @db_path   = options[:dbpath]  if options[:dbpath].present?
    @db_name   = options[:dbname]  if options[:dbname].present?

    @verbose = true     if options[:verbose] == true

    @data_path       = options[:include]      if options[:include].present?
    @world_data_path = options[:worldinclude] if options[:worldinclude].present? 
  end


  def verbose=(boolean)   # add: alias for debug ??
    @verbose = boolean
  end

  def verbose?
    return false if @verbose.nil?   # default verbose/debug flag is false
    @verbose == true
  end


  def db_path
    @db_path || '.'
  end

  def db_name
    @db_name || 'beer.db'
  end


  def data_path=(value)
    @data_path = value
  end

  def data_path
    @data_path || '.'
  end

  def world_data_path
    @world_data_path   # NB: option has no default; return nil
  end

end # class Opts

end # module BeerDb

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
beerdb-1.0.0 lib/beerdb/cli/opts.rb
beerdb-0.10.1 lib/beerdb/cli/opts.rb
beerdb-0.10.0 lib/beerdb/cli/opts.rb
beerdb-0.9.13 lib/beerdb/cli/opts.rb
beerdb-0.9.12 lib/beerdb/cli/opts.rb
beerdb-0.9.11 lib/beerdb/cli/opts.rb
beerdb-0.9.10 lib/beerdb/cli/opts.rb
beerdb-0.9.9 lib/beerdb/cli/opts.rb
beerdb-0.9.8 lib/beerdb/cli/opts.rb
beerdb-0.9.7 lib/beerdb/cli/opts.rb
beerdb-0.9.6 lib/beerdb/cli/opts.rb
beerdb-0.9.5 lib/beerdb/cli/opts.rb
beerdb-0.9.4 lib/beerdb/cli/opts.rb
beerdb-0.9.3 lib/beerdb/cli/opts.rb
beerdb-0.9.2 lib/beerdb/cli/opts.rb
beerdb-0.9.1 lib/beerdb/cli/opts.rb
beerdb-0.9.0 lib/beerdb/cli/opts.rb
beerdb-0.8.2 lib/beerdb/cli/opts.rb