module TaskwarriorWeb::Config
Constants
- JS_DATEFORMATS
A list of date formats, with Taskwarrior's on the left and the JS equivalent on the right.
- RUBY_DATEFORMATS
A list of date formats, with Taskwarrior's on the left and the Ruby equivalent on the right.
Public Class Methods
dateformat(format = :ruby)
click to toggle source
# File lib/taskwarrior-web/model/config.rb, line 55 def self.dateformat(format = :ruby) return nil unless self.store['dateformat'] && format.in?([:ruby, :js]) formats = case format when :ruby then RUBY_DATEFORMATS when :js then JS_DATEFORMATS end self.store['dateformat'].gsub(/(\w)/, formats) end
method_missing(method)
click to toggle source
# File lib/taskwarrior-web/model/config.rb, line 74 def self.method_missing(method) self.store[method.to_s] end
property(prop)
click to toggle source
# File lib/taskwarrior-web/model/config.rb, line 51 def self.property(prop) self.store[prop] end
store()
click to toggle source
# File lib/taskwarrior-web/model/config.rb, line 47 def self.store @store ||= self.parse_config end
supports?(feature)
click to toggle source
# File lib/taskwarrior-web/model/config.rb, line 66 def self.supports?(feature) case feature.to_sym when :editing then self.version.major > 1 when :_show then self.version >= '2.2.0' else false end end
version()
click to toggle source
# File lib/taskwarrior-web/model/config.rb, line 43 def self.version @version ||= Versionomy.parse(`#{TaskwarriorWeb::Runner::TASK_BIN} _version`.strip) end
Private Class Methods
parse_config()
click to toggle source
# File lib/taskwarrior-web/model/config.rb, line 80 def self.parse_config if self.supports? :_show config = `#{TaskwarriorWeb::Runner::TASK_BIN} _show` config.split("\n").inject({}) do |h, line| key,value = line.split('=') h.merge!({ key => value }) end else ParseConfig.new("#{Dir.home}/.taskrc") end end