Class: RichterCatalogue::Artist
- Inherits:
-
Object
- Object
- RichterCatalogue::Artist
- Defined in:
- lib/richter_catalogue/artist.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#age ⇒ Object
Returns the value of attribute age.
-
#artist_url ⇒ Object
Returns the value of attribute artist_url.
-
#education ⇒ Object
Returns the value of attribute education.
-
#movement ⇒ Object
Returns the value of attribute movement.
-
#name ⇒ Object
Returns the value of attribute name.
-
#nationality ⇒ Object
Returns the value of attribute nationality.
-
#paintings ⇒ Object
Returns the value of attribute paintings.
-
#subjects ⇒ Object
Returns the value of attribute subjects.
Class Method Summary collapse
Instance Method Summary collapse
- #add_artist_attributes(attributes_hash) ⇒ Object
- #add_painting(painting) ⇒ Object
-
#initialize(attributes_hash) ⇒ Artist
constructor
A new instance of Artist.
Constructor Details
#initialize(attributes_hash) ⇒ Artist
Returns a new instance of Artist.
5 6 7 8 9 |
# File 'lib/richter_catalogue/artist.rb', line 5 def initialize(attributes_hash) self.add_artist_attributes(attributes_hash) @paintings = [] @@all << self end |
Instance Attribute Details
#age ⇒ Object
Returns the value of attribute age.
2 3 4 |
# File 'lib/richter_catalogue/artist.rb', line 2 def age @age end |
#artist_url ⇒ Object
Returns the value of attribute artist_url.
2 3 4 |
# File 'lib/richter_catalogue/artist.rb', line 2 def artist_url @artist_url end |
#education ⇒ Object
Returns the value of attribute education.
2 3 4 |
# File 'lib/richter_catalogue/artist.rb', line 2 def education @education end |
#movement ⇒ Object
Returns the value of attribute movement.
2 3 4 |
# File 'lib/richter_catalogue/artist.rb', line 2 def movement @movement end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/richter_catalogue/artist.rb', line 2 def name @name end |
#nationality ⇒ Object
Returns the value of attribute nationality.
2 3 4 |
# File 'lib/richter_catalogue/artist.rb', line 2 def nationality @nationality end |
#paintings ⇒ Object
Returns the value of attribute paintings.
2 3 4 |
# File 'lib/richter_catalogue/artist.rb', line 2 def paintings @paintings end |
#subjects ⇒ Object
Returns the value of attribute subjects.
2 3 4 |
# File 'lib/richter_catalogue/artist.rb', line 2 def subjects @subjects end |
Class Method Details
.all ⇒ Object
11 12 13 |
# File 'lib/richter_catalogue/artist.rb', line 11 def self.all @@all end |
.create_from_profile(attributes_hash) ⇒ Object
15 16 17 |
# 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) ⇒ Object
33 34 35 |
# File 'lib/richter_catalogue/artist.rb', line 33 def self.find_by_name(name) self.all.detect{|artist| artist.name == name} end |
Instance Method Details
#add_artist_attributes(attributes_hash) ⇒ Object
19 20 21 22 |
# 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) ⇒ Object
24 25 26 27 |
# 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 |