Class: AsciiArtist::Art

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

Constant Summary collapse

@@all =
[]
@@favorites =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(art, index) ⇒ Art

Returns a new instance of Art.



7
8
9
10
11
# File 'lib/art.rb', line 7

def initialize(art, index)
    @art_text = art
    @index = index
    @@all << self
end

Instance Attribute Details

#art_textObject

Returns the value of attribute art_text.



3
4
5
# File 'lib/art.rb', line 3

def art_text
  @art_text
end

#indexObject

Returns the value of attribute index.



3
4
5
# File 'lib/art.rb', line 3

def index
  @index
end

Class Method Details

.allObject



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

def self.all
    @@all
end

.clearObject



17
18
19
# File 'lib/art.rb', line 17

def self.clear
    @@all = []        
end

Instance Method Details

#add_to_favoritesObject



21
22
23
# File 'lib/art.rb', line 21

def add_to_favorites
    @@favorites << self
end