Class: CheckList::Start
- Inherits:
-
Object
- Object
- CheckList::Start
- Defined in:
- lib/check_list.rb
Overview
The start method for check-list
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Instance Method Summary collapse
-
#handler ⇒ Object
rubocop: enable Layout/HeredocIndentation rubocop: enable Naming/HeredocDelimiterNaming.
-
#initialize ⇒ Start
constructor
A new instance of Start.
-
#set_options ⇒ Object
rubocop: disable Layout/HeredocIndentation rubocop: disable Naming/HeredocDelimiterNaming.
- #update ⇒ Object
- #update_list ⇒ Object
- #update_ref ⇒ Object
- #view ⇒ Object
- #view_list ⇒ Object
- #view_ref ⇒ Object
Constructor Details
#initialize ⇒ Start
Returns a new instance of Start.
19 20 21 22 23 |
# File 'lib/check_list.rb', line 19 def initialize @opts = @filepath = CheckList::HandleFile.new handler end |
Instance Attribute Details
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
17 18 19 |
# File 'lib/check_list.rb', line 17 def opts @opts end |
Instance Method Details
#handler ⇒ Object
rubocop: enable Layout/HeredocIndentation rubocop: enable Naming/HeredocDelimiterNaming
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/check_list.rb', line 46 def handler if @opts[:update_given] update elsif @opts[:view_given] view else CheckList::Menu.new(@filepath, @opts) end rescue CheckList::Exceptions::InvalidOptionError CheckList::Helpers.log 'Invalid list option selection' end |
#set_options ⇒ Object
rubocop: disable Layout/HeredocIndentation rubocop: disable Naming/HeredocDelimiterNaming
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/check_list.rb', line 27 def Optimist. do version "check-list #{CheckList::Config.version} (c) 2022 Kyle Swaffield" <<~EOS Check-List Usage: check-list [options] <list name> | <reference name> where [options] are: EOS opt :list, 'checklist name', :type => :string # flag --list, default false opt :ref, 'Reference', :type => :string # flag --ref, default false opt :view, 'View browser list' opt :update, 'Update list' end end |
#update ⇒ Object
58 59 60 61 62 63 |
# File 'lib/check_list.rb', line 58 def update @update = CheckList::Update.new(@opts, @filepath) return update_ref if @opts[:list_given] && @opts[:ref_given] update_list end |
#update_list ⇒ Object
69 70 71 |
# File 'lib/check_list.rb', line 69 def update_list @update.show_lists(nil) end |
#update_ref ⇒ Object
65 66 67 |
# File 'lib/check_list.rb', line 65 def update_ref @update.show_list('', nil) end |
#view ⇒ Object
73 74 75 76 77 |
# File 'lib/check_list.rb', line 73 def view return view_ref if @opts[:list_given] && @opts[:ref_given] view_list end |
#view_list ⇒ Object
83 84 85 |
# File 'lib/check_list.rb', line 83 def view_list CheckList::View.new end |
#view_ref ⇒ Object
79 80 81 |
# File 'lib/check_list.rb', line 79 def view_ref puts 'view ref' end |