Class: Beans::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/beans/config.rb

Class Method Summary collapse

Class Method Details

.configObject



7
8
9
# File 'lib/beans/config.rb', line 7

def config
  @config ||= YAML.load(open(ENV['HOME']+'/.beans.yml'))
end

.dollars_per_secondObject



38
39
40
41
42
# File 'lib/beans/config.rb', line 38

def dollars_per_second
  seconds_per_week = hours_per_week*3600.0
  weeks_per_year = 52.0
  salary_per_year / weeks_per_year / seconds_per_week
end

.hours_per_weekObject



30
31
32
# File 'lib/beans/config.rb', line 30

def hours_per_week
  config['hours_per_week']
end

.perObject



15
16
17
# File 'lib/beans/config.rb', line 15

def per
  config['per']
end

.portObject



34
35
36
# File 'lib/beans/config.rb', line 34

def port
  config['port']
end

.salaryObject



11
12
13
# File 'lib/beans/config.rb', line 11

def salary
  config['salary']
end

.salary_per_yearObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/beans/config.rb', line 19

def salary_per_year
  case per.downcase
    when 'year'
      salary
    when 'month'
      salary*12
    when 'hour'
      salary*hours_per_week*52
  end
end

.seconds_between_notificationsObject



44
45
46
# File 'lib/beans/config.rb', line 44

def seconds_between_notifications
  config['notify_every'] || 1800
end