Class: CryptoPrice::Coin

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

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(symbol, name, price, change, marketcap) ⇒ Coin

Returns a new instance of Coin.



8
9
10
11
12
13
14
15
# File 'lib/crypto_price/coin.rb', line 8

def initialize(symbol, name, price, change , marketcap)
  @symbol = symbol
  @name = name
  @price = price
  @change = change
  @marketcap = marketcap
  @@all << self
end

Instance Attribute Details

#changeObject

Returns the value of attribute change.



4
5
6
# File 'lib/crypto_price/coin.rb', line 4

def change
  @change
end

#marketcapObject

Returns the value of attribute marketcap.



4
5
6
# File 'lib/crypto_price/coin.rb', line 4

def marketcap
  @marketcap
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/crypto_price/coin.rb', line 4

def name
  @name
end

#priceObject

Returns the value of attribute price.



4
5
6
# File 'lib/crypto_price/coin.rb', line 4

def price
  @price
end

#symbolObject

Returns the value of attribute symbol.



4
5
6
# File 'lib/crypto_price/coin.rb', line 4

def symbol
  @symbol
end

#volumeObject

Returns the value of attribute volume.



4
5
6
# File 'lib/crypto_price/coin.rb', line 4

def volume
  @volume
end

Class Method Details

.allObject



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

def self.all
  @@all
end