Module: Domodoro::Config
Instance Attribute Summary collapse
-
#sound ⇒ Object
Returns the value of attribute sound.
-
#visual ⇒ Object
Returns the value of attribute visual.
Instance Method Summary collapse
Instance Attribute Details
#sound ⇒ Object
Returns the value of attribute sound.
6 7 8 |
# File 'lib/domodoro/config.rb', line 6 def sound @sound end |
#visual ⇒ Object
Returns the value of attribute visual.
6 7 8 |
# File 'lib/domodoro/config.rb', line 6 def visual @visual end |
Instance Method Details
#get_server_configuration ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/domodoro/config.rb', line 21 def get_server_configuration config = OpenStruct.new if File.exist?(File.('~/.domodororc')) file = YAML.load(File.read(File.('~/.domodororc')))['server'] config.pomodoro_duration = file['pomodoro_duration'] config.pomodoro_break = file['pomodoro_break'] config.long_break_after = file['long_break_after'] config.day_start = Timepoint.new(file['day_start']) config.day_end = Timepoint.new(file['day_end']) config.lunch_time = Timepoint.new(file['lunch_time']) config.lunch_duration = file['lunch_duration'] end config.pomodoro_duration ||= 25 config.pomodoro_break ||= 5 config.long_break_after ||= 4 config.day_start ||= Timepoint.new('08:30') config.day_end ||= Timepoint.new('16:30') config.lunch_time ||= Timepoint.new('13:00') config.lunch_duration ||= 30 config end |
#load_client_configuration ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/domodoro/config.rb', line 9 def load_client_configuration if File.exist?(File.('~/.domodororc')) file = YAML.load(File.read(File.('~/.domodororc'))) self.visual = file['visual'] self.sound = file['sound'] else self.visual = true self.sound = true end end |