Class: Works_of_Art
- Inherits:
-
Object
- Object
- Works_of_Art
- Defined in:
- lib/art_throughout_the_years/works_of_art.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
-
#year ⇒ Object
Returns the value of attribute year.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name) ⇒ Works_of_Art
constructor
A new instance of Works_of_Art.
- #list_artists ⇒ Object
- #list_artwork ⇒ Object
Constructor Details
#initialize(name) ⇒ Works_of_Art
6 7 8 9 10 11 |
# File 'lib/art_throughout_the_years/works_of_art.rb', line 6 def initialize(name) @name = name @title = title @year = [] @@all << self end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/art_throughout_the_years/works_of_art.rb', line 3 def description @description end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/art_throughout_the_years/works_of_art.rb', line 3 def name @name end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/art_throughout_the_years/works_of_art.rb', line 3 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/art_throughout_the_years/works_of_art.rb', line 3 def url @url end |
#year ⇒ Object
Returns the value of attribute year.
3 4 5 |
# File 'lib/art_throughout_the_years/works_of_art.rb', line 3 def year @year end |
Class Method Details
.all ⇒ Object
13 14 15 |
# File 'lib/art_throughout_the_years/works_of_art.rb', line 13 def self.all @@all end |
Instance Method Details
#list_artists ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/art_throughout_the_years/works_of_art.rb', line 17 def list_artists input = gets.strip if input == "list" puts "" artists = artist.name.all artists.each_with_index(1) {|artist, index| puts "#{index}, #{artist.name}"} end end |
#list_artwork ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/art_throughout_the_years/works_of_art.rb', line 26 def list_artwork input = gets.strip if input == "list" artwork = artwork.title.all artwork.each_with_index(1) {|artwork, index| puts "#{index}, #{artwork.name}"} end end |