class NationalDay

Attributes

has_details[R]
image[RW]
name[RW]
summary[RW]
url[RW]

Public Class Methods

new(hash) click to toggle source
# File lib/nationalday.rb, line 4
def initialize(hash)
        hash.each do |k,v|
                self.send("#{k}=",v)
        end
        @has_details=false
end

Public Instance Methods

==(other) click to toggle source
# File lib/nationalday.rb, line 21
def ==(other)
        name==other.name&&url==other.url&&summary==other.summary&&image==other.image
end
add_details(hash=Scraper.scrape_day_details(url)) click to toggle source

add details from the provided has, if no hash is provided details with automatically be pulled from the url Checkl to see if has_details is true to avoid excess network requests

# File lib/nationalday.rb, line 13
def add_details(hash=Scraper.scrape_day_details(url))
        hash.each do |k,v|
                #tfw you cant check to see if a method is defined with a string, only a symbol
                self.send("#{k}=",v)
        end
        @has_details=true
end