Class: HouseFloorBills::Schedule
- Inherits:
-
Object
- Object
- HouseFloorBills::Schedule
- Defined in:
- lib/house_floor_bills/schedule.rb
Instance Attribute Summary collapse
-
#last_updated ⇒ Object
Returns the value of attribute last_updated.
-
#published ⇒ Object
Returns the value of attribute published.
-
#title ⇒ Object
Returns the value of attribute title.
-
#week ⇒ Object
Returns the value of attribute week.
Instance Method Summary collapse
- #add_bill(bill) ⇒ Object
- #bills ⇒ Object
- #find_bill(id) ⇒ Object
-
#initialize ⇒ Schedule
constructor
A new instance of Schedule.
Constructor Details
#initialize ⇒ Schedule
Returns a new instance of Schedule.
6 7 8 |
# File 'lib/house_floor_bills/schedule.rb', line 6 def initialize @bills = [] end |
Instance Attribute Details
#last_updated ⇒ Object
Returns the value of attribute last_updated.
4 5 6 |
# File 'lib/house_floor_bills/schedule.rb', line 4 def last_updated @last_updated end |
#published ⇒ Object
Returns the value of attribute published.
4 5 6 |
# File 'lib/house_floor_bills/schedule.rb', line 4 def published @published end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/house_floor_bills/schedule.rb', line 4 def title @title end |
#week ⇒ Object
Returns the value of attribute week.
4 5 6 |
# File 'lib/house_floor_bills/schedule.rb', line 4 def week @week end |
Instance Method Details
#add_bill(bill) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/house_floor_bills/schedule.rb', line 18 def add_bill(bill) if !bill.is_a?(HouseFloorBills::Bill) #&& !bill.title.empty? raise InvalidType, "must be a Bill" else @bills << bill end end |
#bills ⇒ Object
10 11 12 |
# File 'lib/house_floor_bills/schedule.rb', line 10 def bills @bills.dup.freeze end |
#find_bill(id) ⇒ Object
14 15 16 |
# File 'lib/house_floor_bills/schedule.rb', line 14 def find_bill(id) @bills[id.to_i-1] end |