Module: Faker::PrettySeries::DataReader
- Defined in:
- lib/faker/pretty_series/data_reader.rb
Class Method Summary collapse
Class Method Details
.sample_data(data_name, key) ⇒ String
10 11 12 13 14 15 |
# File 'lib/faker/pretty_series/data_reader.rb', line 10 def self.sample_data(data_name, key) data = YAML.load_file("#{__dir__}/../../data/#{data_name}.yml") values = data.map { |element| element[key] }.reject { |v| !v || v.empty? } values.uniq.sample end |