Class: Faker::CryptoCoin
Constant Summary collapse
- COIN_NAME =
0
- ACRONYM =
1
- URL_LOGO =
2
Constants inherited from Base
Base::LLetters, Base::Letters, Base::NOT_GIVEN, Base::Numbers, Base::ULetters
Class Method Summary collapse
-
.acronym(coin: coin_array) ⇒ String
Produces a random crypto coin acronym.
-
.coin_array ⇒ Array<String>
Produces a random crypto coin’s name, acronym and logo in an array.
-
.coin_hash ⇒ Hash
Produces a random crypto coin’s name, acronym and logo in a hash.
-
.coin_name(coin: coin_array) ⇒ String
Produces a random crypto coin name.
-
.url_logo(coin: coin_array) ⇒ String
Produces a random crypto coin logo url.
Methods inherited from Base
bothify, disable_enforce_available_locales, fetch, fetch_all, flexible, generate, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, shuffle, shuffle!, translate, unique, with_locale
Class Method Details
.acronym(coin: coin_array) ⇒ String
Produces a random crypto coin acronym.
32 33 34 |
# File 'lib/faker/default/crypto_coin.rb', line 32 def acronym(coin: coin_array) coin[ACRONYM] end |
.coin_array ⇒ Array<String>
Produces a random crypto coin’s name, acronym and logo in an array.
58 59 60 |
# File 'lib/faker/default/crypto_coin.rb', line 58 def coin_array fetch('crypto_coin.coin').split(',').map(&:strip) end |
.coin_hash ⇒ Hash
Produces a random crypto coin’s name, acronym and logo in a hash.
71 72 73 74 75 76 77 78 79 |
# File 'lib/faker/default/crypto_coin.rb', line 71 def coin_hash coin = coin_array { name: coin_name(coin: coin), acronym: acronym(coin: coin), url_logo: url_logo(coin: coin) } end |
.coin_name(coin: coin_array) ⇒ String
Produces a random crypto coin name.
19 20 21 |
# File 'lib/faker/default/crypto_coin.rb', line 19 def coin_name(coin: coin_array) coin[COIN_NAME] end |
.url_logo(coin: coin_array) ⇒ String
Produces a random crypto coin logo url.
45 46 47 |
# File 'lib/faker/default/crypto_coin.rb', line 45 def url_logo(coin: coin_array) coin[URL_LOGO] end |