Object
# File lib/randexp/wordlists/female_names.rb, line 12 def self.female_first_names(options = {}) if options.has_key?(:length) female_first_names_by_length[options[:length]] else @@female_first_names ||= load_female_first_names end end
# File lib/randexp/wordlists/female_names.rb, line 20 def self.female_first_names_by_length @@female_first_names_by_length ||= female_first_names.inject({}) {|h, w| (h[w.size] ||= []) << w; h } end
# File lib/randexp/wordlists/real_name.rb, line 23 def self.first_names(options) case options[:gender].to_s when /^male/ male_first_names(options) when /^female/ female_first_names(options) else [male_first_names(options), female_first_names(options)].pick end end
# File lib/randexp/wordlists/female_names.rb, line 3 def self.load_female_first_names dir = File.dirname(__FILE__) if File.exists?("#{dir}/../../../wordlists/female_names") File.read("#{dir}/../../../wordlists/female_names").split else raise "words file not found" end end
# File lib/randexp/wordlists/male_names.rb, line 3 def self.load_male_first_names dir = File.dirname(__FILE__) if File.exists?("#{dir}/../../../wordlists/male_names") File.read("#{dir}/../../../wordlists/male_names").split else raise "words file not found" end end
# File lib/randexp/wordlists/real_name.rb, line 2 def self.load_surnames dir = File.dirname(__FILE__) if File.exists?("#{dir}/../../../wordlists/surnames") File.read("#{dir}/../../../wordlists/surnames").split else raise "words file not found" end end
# File lib/randexp/wordlists/male_names.rb, line 12 def self.male_first_names(options = {}) if options.has_key?(:length) male_first_names_by_length[options[:length]] else @@male_first_names ||= load_male_first_names end end
# File lib/randexp/wordlists/male_names.rb, line 20 def self.male_first_names_by_length @@male_first_names_by_length ||= male_first_names.inject({}) {|h, w| (h[w.size] ||= []) << w; h } end
Generated with the Darkfish Rdoc Generator 2.