Class: Rtasklib::TaskWarrior
- Inherits:
-
Object
- Object
- Rtasklib::TaskWarrior
- Includes:
- Controller
- Defined in:
- lib/rtasklib.rb
Constant Summary collapse
- DEFAULTS =
{ json_array: 'true', verbose: 'nothing', gc: 'off', confirmation: 'no', dependency_confirmation: 'no', exit_on_missing_db: 'yes', }
- LOWEST_VERSION =
Gem::Version.new('2.4.0')
Instance Attribute Summary collapse
-
#data_location ⇒ Object
readonly
Returns the value of attribute data_location.
-
#override ⇒ Object
readonly
Returns the value of attribute override.
-
#override_a ⇒ Object
readonly
Returns the value of attribute override_a.
-
#override_str ⇒ Object
readonly
Returns the value of attribute override_str.
-
#taskrc ⇒ Object
readonly
Returns the value of attribute taskrc.
-
#udas ⇒ Object
readonly
Returns the value of attribute udas.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #check_version(version = nil) ⇒ Object
-
#initialize(data = "#{Dir.home}/.task", opts = {}) ⇒ TaskWarrior
constructor
A new instance of TaskWarrior.
Methods included from Controller
#add!, #all, #count, #create_uda!, #delete!, #done!, #get_rc, #get_uda_names, #get_udas, #get_version, #modify!, #some, #start!, #stop!, #uda_exists?, #undo!, #update_config!
Constructor Details
#initialize(data = "#{Dir.home}/.task", opts = {}) ⇒ TaskWarrior
Returns a new instance of TaskWarrior.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/rtasklib.rb', line 28 def initialize data="#{Dir.home}/.task", opts = {} # Check TaskWarrior version, and throw warning if unavailable begin @version = check_version rescue warn "Couldn't verify TaskWarrior's version" end @data_location = data override_h = DEFAULTS.merge({data_location: data}).merge(opts) @override = Taskrc.new(override_h, :hash) @override_a = override.model_to_rc @taskrc = get_rc @udas = get_udas add_udas_to_model!(udas) unless udas.nil? end |
Instance Attribute Details
#data_location ⇒ Object (readonly)
Returns the value of attribute data_location.
13 14 15 |
# File 'lib/rtasklib.rb', line 13 def data_location @data_location end |
#override ⇒ Object (readonly)
Returns the value of attribute override.
13 14 15 |
# File 'lib/rtasklib.rb', line 13 def override @override end |
#override_a ⇒ Object (readonly)
Returns the value of attribute override_a.
13 14 15 |
# File 'lib/rtasklib.rb', line 13 def override_a @override_a end |
#override_str ⇒ Object (readonly)
Returns the value of attribute override_str.
13 14 15 |
# File 'lib/rtasklib.rb', line 13 def override_str @override_str end |
#taskrc ⇒ Object (readonly)
Returns the value of attribute taskrc.
13 14 15 |
# File 'lib/rtasklib.rb', line 13 def taskrc @taskrc end |
#udas ⇒ Object (readonly)
Returns the value of attribute udas.
13 14 15 |
# File 'lib/rtasklib.rb', line 13 def udas @udas end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
13 14 15 |
# File 'lib/rtasklib.rb', line 13 def version @version end |
Instance Method Details
#check_version(version = nil) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/rtasklib.rb', line 45 def check_version version=nil version = get_version if version.nil? if version < LOWEST_VERSION warn "The current TaskWarrior version, #{version}, is untested" end version end |