Parent

RealName

Public Class Methods

female_first_names(options = {}) click to toggle source
    # 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
female_first_names_by_length() click to toggle source
    # 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
first_names(options) click to toggle source
    # 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
load_female_first_names() click to toggle source
    # 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
load_male_first_names() click to toggle source
    # 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
load_surnames() click to toggle source
   # 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
male_first_names(options = {}) click to toggle source
    # 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
male_first_names_by_length() click to toggle source
    # 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
surnames(options = {}) click to toggle source
    # File lib/randexp/wordlists/real_name.rb, line 11
11:   def self.surnames(options = {})
12:     if options.has_key?(:length)
13:       surnames_by_length[options[:length]]
14:     else
15:       @@surnames ||= load_surnames
16:     end
17:   end
surnames_by_length() click to toggle source
    # File lib/randexp/wordlists/real_name.rb, line 19
19:   def self.surnames_by_length
20:     @@surnames_by_length ||= surnames.inject({}) {|h, w| (h[w.size] ||= []) << w; h }
21:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.