Class: HouseFloorBills::Schedule

Inherits:
Object
  • Object
show all
Defined in:
lib/house_floor_bills/schedule.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSchedule

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_updatedObject

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

#publishedObject

Returns the value of attribute published.



4
5
6
# File 'lib/house_floor_bills/schedule.rb', line 4

def published
  @published
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/house_floor_bills/schedule.rb', line 4

def title
  @title
end

#weekObject

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

#billsObject



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