Class: Faker::CryptoCoin

Inherits:
Base
  • Object
show all
Defined in:
lib/faker/default/crypto_coin.rb

Constant Summary collapse

COIN_NAME =
0
ACRONYM =
1
URL_LOGO =
2

Constants inherited from Base

Base::Letters, Base::Numbers, Base::ULetters

Class Method Summary collapse

Methods inherited from Base

bothify, disable_enforce_available_locales, fetch, fetch_all, flexible, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, shuffle, translate, unique, with_locale

Class Method Details

.acronym(coin = coin_array) ⇒ Object


14
15
16
# File 'lib/faker/default/crypto_coin.rb', line 14

def acronym(coin = coin_array)
  coin[ACRONYM]
end

.coin_arrayObject


22
23
24
# File 'lib/faker/default/crypto_coin.rb', line 22

def coin_array
  fetch('crypto_coin.coin').split(',').map(&:strip)
end

.coin_hashObject


26
27
28
29
# File 'lib/faker/default/crypto_coin.rb', line 26

def coin_hash
  coin = coin_array
  { name: coin_name(coin), acronym: acronym(coin), url_logo: (coin) }
end

.coin_name(coin = coin_array) ⇒ Object


10
11
12
# File 'lib/faker/default/crypto_coin.rb', line 10

def coin_name(coin = coin_array)
  coin[COIN_NAME]
end

.url_logo(coin = coin_array) ⇒ Object


18
19
20
# File 'lib/faker/default/crypto_coin.rb', line 18

def (coin = coin_array)
  coin[URL_LOGO]
end