lib/beerdb/cli/opts.rb in beerdb-0.0.1 vs lib/beerdb/cli/opts.rb in beerdb-0.1.0
- old
+ new
@@ -1,56 +1,40 @@
-module BeerDB
+module BeerDb
class Opts
- def create=(boolean)
- @create = boolean
- end
- def create?
- return false if @create.nil? # default create flag is false
- @create == true
- end
-
+ def merge_commander_options!( options = {} )
+ @db_path = options[:dbpath] if options[:dbpath].present?
+ @db_name = options[:dbname] if options[:dbname].present?
- def delete=(boolean)
- @delete = boolean
+ @data_path = options[:include] if options[:include].present?
+
+ @world_data_path = options[:worldinclude] if options[:worldinclude].present?
end
- def delete?
- return false if @delete.nil? # default create flag is false
- @delete == true
- end
- # use loader? (that is, built-in seed data)
- def load=(boolean)
- @load = boolean
+ def db_path
+ @db_path || '.'
end
- def load?
- return false if @load.nil? # default create flag is false
- @load == true
+ def db_name
+ @db_name || 'beer.db'
end
- def output_path=(value)
- @output_path = value
- end
-
- def output_path
- @output_path || '.'
- 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
+end # module BeerDb