Class: SportDb::Opts
- Inherits:
-
Object
- Object
- SportDb::Opts
- Defined in:
- lib/sportdb/cli/opts.rb
Instance Method Summary collapse
- #clubs_dir ⇒ Object
-
#clubs_dir? ⇒ Boolean
note: let’s you check if clubs_dir set (by default it’s NOT set).
- #datafile ⇒ Object
-
#datafile? ⇒ Boolean
note: let’s you check if datafile is set (or “untouched”).
- #db_name ⇒ Object
- #db_path ⇒ Object
- #leagues_dir ⇒ Object
- #leagues_dir? ⇒ Boolean
- #merge_gli_options!(options = {}) ⇒ Object
-
#verbose=(boolean) ⇒ Object
add: alias for debug ??.
- #verbose? ⇒ Boolean
Instance Method Details
#clubs_dir ⇒ Object
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)
37 |
# File 'lib/sportdb/cli/opts.rb', line 37 def clubs_dir?() @clubs_dir.nil? == false; end |
#datafile ⇒ Object
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”)
33 |
# File 'lib/sportdb/cli/opts.rb', line 33 def datafile?() @datafile; end |
#db_name ⇒ Object
30 |
# File 'lib/sportdb/cli/opts.rb', line 30 def db_name() @db_name || 'sport.db'; end |
#db_path ⇒ Object
29 |
# File 'lib/sportdb/cli/opts.rb', line 29 def db_path() @db_path || '.'; end |
#leagues_dir ⇒ Object
39 |
# File 'lib/sportdb/cli/opts.rb', line 39 def leagues_dir() @leagues_dir; end |
#leagues_dir? ⇒ 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 ( = {} ) @db_path = [:dbpath] if [:dbpath].present? @db_name = [:dbname] if [:dbname].present? @datafile = [:datafile] if [:datafile].present? @verbose = true if [:verbose] == true @leagues_dir = [:'leagues-dir'] if [:'leagues-dir'].present? @clubs_dir = [:'clubs-dir'] if [:'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
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 |