class RichterCatalogue::Artist
Attributes
age[RW]
artist_url[RW]
education[RW]
movement[RW]
name[RW]
nationality[RW]
paintings[RW]
subjects[RW]
Public Class Methods
all()
click to toggle source
# File lib/richter_catalogue/artist.rb, line 11 def self.all @@all end
create_from_profile(attributes_hash)
click to toggle source
# File lib/richter_catalogue/artist.rb, line 15 def self.create_from_profile(attributes_hash) RichterCatalogue::Artist.new(attributes_hash) end
find_by_name(name)
click to toggle source
# File lib/richter_catalogue/artist.rb, line 33 def self.find_by_name(name) self.all.detect{|artist| artist.name == name} end
new(attributes_hash)
click to toggle source
# File lib/richter_catalogue/artist.rb, line 5 def initialize(attributes_hash) self.add_artist_attributes(attributes_hash) @paintings = [] @@all << self end
Public Instance Methods
add_artist_attributes(attributes_hash)
click to toggle source
# File lib/richter_catalogue/artist.rb, line 19 def add_artist_attributes(attributes_hash) attributes_hash.each {|key, value| self.send("#{key}=", value)} self end
add_painting(painting)
click to toggle source
# File lib/richter_catalogue/artist.rb, line 24 def add_painting(painting) painting.artist = self unless painting.artist == self @paintings << painting unless @paintings.include?(painting) end