Class: SportDb::Opts

Inherits:
Object
  • Object
show all
Defined in:
lib/sportdb/cli/opts.rb

Instance Method Summary collapse

Instance Method Details

#clubs_dirObject



36
# File 'lib/sportdb/cli/opts.rb', line 36

def clubs_dir()    @clubs_dir;  end

#clubs_dir?Boolean

note: let’s you check if clubs_dir set (by default it’s NOT set)

Returns:

  • (Boolean)


37
# File 'lib/sportdb/cli/opts.rb', line 37

def clubs_dir?()   @clubs_dir.nil? == false;  end

#datafileObject



32
# File 'lib/sportdb/cli/opts.rb', line 32

def datafile()  @datafile || './Datafile';  end

#datafile?Boolean

note: let’s you check if datafile is set (or “untouched”)

Returns:

  • (Boolean)


33
# File 'lib/sportdb/cli/opts.rb', line 33

def datafile?() @datafile;  end

#db_nameObject



30
# File 'lib/sportdb/cli/opts.rb', line 30

def db_name()   @db_name || 'sport.db';  end

#db_pathObject



29
# File 'lib/sportdb/cli/opts.rb', line 29

def db_path()   @db_path || '.';         end

#leagues_dirObject



39
# File 'lib/sportdb/cli/opts.rb', line 39

def leagues_dir()  @leagues_dir;  end

#leagues_dir?Boolean

Returns:

  • (Boolean)


40
# File 'lib/sportdb/cli/opts.rb', line 40

def leagues_dir?() @leagues_dir.nil? == false; end

#merge_gli_options!(options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/sportdb/cli/opts.rb', line 7

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

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

  @leagues_dir = options[:'leagues-dir']   if options[:'leagues-dir'].present?
  @clubs_dir   = options[:'clubs-dir']     if options[:'clubs-dir'].present?
end

#verbose=(boolean) ⇒ Object

add: alias for debug ??



19
20
21
# File 'lib/sportdb/cli/opts.rb', line 19

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

#verbose?Boolean

Returns:

  • (Boolean)


23
24
25
26
# File 'lib/sportdb/cli/opts.rb', line 23

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