Class: Works_of_Art

Inherits:
Object
  • Object
show all
Defined in:
lib/art_throughout_the_years/works_of_art.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#descriptionObject

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

#nameObject

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

#titleObject

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

#urlObject

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

#yearObject

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

.allObject



13
14
15
# File 'lib/art_throughout_the_years/works_of_art.rb', line 13

def self.all
  @@all
end

Instance Method Details

#list_artistsObject



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_artworkObject



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