Object
# File lib/randexp/wordlists/female_names.rb, line 12 12: def self.female_first_names(options = {}) 13: if options.has_key?(:length) 14: female_first_names_by_length[options[:length]] 15: else 16: @@female_first_names ||= load_female_first_names 17: end 18: end
# File lib/randexp/wordlists/female_names.rb, line 20 20: def self.female_first_names_by_length 21: @@female_first_names_by_length ||= female_first_names.inject({}) {|h, w| (h[w.size] ||= []) << w; h } 22: end
# File lib/randexp/wordlists/real_name.rb, line 23 23: def self.first_names(options) 24: case options[:gender].to_s 25: when /^male/ 26: male_first_names(options) 27: when /^female/ 28: female_first_names(options) 29: else 30: [male_first_names(options), female_first_names(options)].pick 31: end 32: end
# File lib/randexp/wordlists/female_names.rb, line 3 3: def self.load_female_first_names 4: dir = File.dirname(__FILE__) 5: if File.exists?("#{dir}/../../../wordlists/female_names") 6: File.read("#{dir}/../../../wordlists/female_names").split 7: else 8: raise "words file not found" 9: end 10: end
# File lib/randexp/wordlists/male_names.rb, line 3 3: def self.load_male_first_names 4: dir = File.dirname(__FILE__) 5: if File.exists?("#{dir}/../../../wordlists/male_names") 6: File.read("#{dir}/../../../wordlists/male_names").split 7: else 8: raise "words file not found" 9: end 10: end
# File lib/randexp/wordlists/real_name.rb, line 2 2: def self.load_surnames 3: dir = File.dirname(__FILE__) 4: if File.exists?("#{dir}/../../../wordlists/surnames") 5: File.read("#{dir}/../../../wordlists/surnames").split 6: else 7: raise "words file not found" 8: end 9: end
# File lib/randexp/wordlists/male_names.rb, line 12 12: def self.male_first_names(options = {}) 13: if options.has_key?(:length) 14: male_first_names_by_length[options[:length]] 15: else 16: @@male_first_names ||= load_male_first_names 17: end 18: end
# File lib/randexp/wordlists/male_names.rb, line 20 20: def self.male_first_names_by_length 21: @@male_first_names_by_length ||= male_first_names.inject({}) {|h, w| (h[w.size] ||= []) << w; h } 22: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.