class PaBillreader::Bill
Attributes
branch[RW]
full_text_url[RW]
last_action[RW]
memo_url[RW]
number[RW]
prime_sponsor[RW]
short_title[RW]
Public Class Methods
all()
click to toggle source
# File lib/pa_billreader/bill.rb, line 14 def self.all @@all end
create_from_array(array)
click to toggle source
# File lib/pa_billreader/bill.rb, line 31 def self.create_from_array(array) array.each { |bill_hash| PaBillreader::Bill.new(bill_hash) } end
find_by_number(number, branch)
click to toggle source
# File lib/pa_billreader/bill.rb, line 43 def self.find_by_number(number, branch) self.all.detect { |bill| bill.number == number && bill.branch == branch } end
house_bills()
click to toggle source
# File lib/pa_billreader/bill.rb, line 48 def self.house_bills self.all.select {|bill| bill.branch == "H" } end
new(bill_hash)
click to toggle source
# File lib/pa_billreader/bill.rb, line 7 def initialize(bill_hash) bill_hash.each { |attr, value| self.send("#{attr}=", value) } save end
senate_bills()
click to toggle source
# File lib/pa_billreader/bill.rb, line 52 def self.senate_bills self.all.select {|bill| bill.branch == "S" } end
size()
click to toggle source
# File lib/pa_billreader/bill.rb, line 18 def self.size @@all.size end
sorted!()
click to toggle source
# File lib/pa_billreader/bill.rb, line 26 def self.sorted! @@all.sort_by! {|bill| bill.number.to_i } end
Public Instance Methods
add_bill_attributes(attr_hash)
click to toggle source
# File lib/pa_billreader/bill.rb, line 37 def add_bill_attributes(attr_hash) attr_hash.each { |attr, value| self.send("#{attr}=",value) } end
save()
click to toggle source
# File lib/pa_billreader/bill.rb, line 22 def save @@all << self end