Class: Beans::Config
- Inherits:
-
Object
- Object
- Beans::Config
- Defined in:
- lib/beans/config.rb
Class Method Summary collapse
- .config ⇒ Object
- .dollars_per_second ⇒ Object
- .hours_per_week ⇒ Object
- .per ⇒ Object
- .port ⇒ Object
- .salary ⇒ Object
- .salary_per_year ⇒ Object
- .seconds_between_notifications ⇒ Object
Class Method Details
.config ⇒ Object
7 8 9 |
# File 'lib/beans/config.rb', line 7 def config @config ||= YAML.load(open(ENV['HOME']+'/.beans.yml')) end |
.dollars_per_second ⇒ Object
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_week ⇒ Object
30 31 32 |
# File 'lib/beans/config.rb', line 30 def hours_per_week config['hours_per_week'] end |
.per ⇒ Object
15 16 17 |
# File 'lib/beans/config.rb', line 15 def per config['per'] end |
.port ⇒ Object
34 35 36 |
# File 'lib/beans/config.rb', line 34 def port config['port'] end |
.salary ⇒ Object
11 12 13 |
# File 'lib/beans/config.rb', line 11 def salary config['salary'] end |
.salary_per_year ⇒ Object
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_notifications ⇒ Object
44 45 46 |
# File 'lib/beans/config.rb', line 44 def seconds_between_notifications config['notify_every'] || 1800 end |