Class: Rivendell::DB::Cut
- Inherits:
-
Object
- Object
- Rivendell::DB::Cut
- Includes:
- DataMapper::Resource
- Defined in:
- lib/rivendell/db/cut.rb
Constant Summary collapse
- @@days =
%w{sun mon tue wed thu fri sat}.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #days ⇒ Object
- #days=(days) ⇒ Object
- #enable_on(day, enabled = true) ⇒ Object
- #enable_on?(day) ⇒ Boolean
Class Method Details
.days ⇒ Object
17 18 19 |
# File 'lib/rivendell/db/cut.rb', line 17 def self.days @@days end |
Instance Method Details
#days ⇒ Object
33 34 35 36 37 |
# File 'lib/rivendell/db/cut.rb', line 33 def days self.class.days.select do |day| enable_on? day end end |
#days=(days) ⇒ Object
39 40 41 42 43 |
# File 'lib/rivendell/db/cut.rb', line 39 def days=(days) self.class.days.each do |day| enable_on day, days.include?(day) end end |
#enable_on(day, enabled = true) ⇒ Object
29 30 31 |
# File 'lib/rivendell/db/cut.rb', line 29 def enable_on(day, enabled = true) send("#{day}=", enabled ? 'Y' : 'N') end |
#enable_on?(day) ⇒ Boolean
25 26 27 |
# File 'lib/rivendell/db/cut.rb', line 25 def enable_on?(day) send(day) == 'Y' end |