randomperson 0.0.19 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/.gitignore +2 -0
  2. data/CHANGELOG +2 -0
  3. data/Manifest +22 -2
  4. data/README.markdown +475 -0
  5. data/lib/randomperson/Loader.rb +62 -0
  6. data/lib/randomperson/Names/AmericanFemaleFirst.rb +10 -8
  7. data/lib/randomperson/Names/AmericanLast.rb +13 -10
  8. data/lib/randomperson/Names/AmericanMaleFirst.rb +11 -8
  9. data/lib/randomperson/Names/AmericanPrefix.rb +16 -18
  10. data/lib/randomperson/Names/AmericanSuffix.rb +26 -16
  11. data/lib/randomperson/Names/AncientGreekFemaleFirst.rb +12 -8
  12. data/lib/randomperson/Names/AncientGreekLast.rb +11 -8
  13. data/lib/randomperson/Names/AncientGreekMaleFirst.rb +11 -8
  14. data/lib/randomperson/Names/AnyLast.rb +11 -9
  15. data/lib/randomperson/Names/BasqueFemaleFirst.rb +10 -9
  16. data/lib/randomperson/Names/BasqueLast.rb +9 -8
  17. data/lib/randomperson/Names/BasqueMaleFirst.rb +10 -9
  18. data/lib/randomperson/Names/BritishPrefix.rb +10 -16
  19. data/lib/randomperson/Names/BritishSuffix.rb +21 -16
  20. data/lib/randomperson/Names/EnglishFemaleFirst.rb +10 -9
  21. data/lib/randomperson/Names/EnglishLast.rb +12 -11
  22. data/lib/randomperson/Names/EnglishMaleFirst.rb +10 -9
  23. data/lib/randomperson/Names/EnglishPrefix.rb +11 -15
  24. data/lib/randomperson/Names/FinnishFemaleFirst.rb +10 -8
  25. data/lib/randomperson/Names/FinnishLast.rb +9 -8
  26. data/lib/randomperson/Names/FinnishMaleFirst.rb +10 -9
  27. data/lib/randomperson/Names/FinnishPrefix.rb +16 -18
  28. data/lib/randomperson/Names/FrenchFemaleFirst.rb +10 -9
  29. data/lib/randomperson/Names/FrenchLast.rb +12 -11
  30. data/lib/randomperson/Names/FrenchMaleFirst.rb +11 -10
  31. data/lib/randomperson/Names/GermanFemaleFirst.rb +10 -9
  32. data/lib/randomperson/Names/GermanLast.rb +9 -8
  33. data/lib/randomperson/Names/GermanMaleFirst.rb +10 -9
  34. data/lib/randomperson/Names/ScottishFemaleFirst.rb +10 -9
  35. data/lib/randomperson/Names/ScottishLast.rb +11 -10
  36. data/lib/randomperson/Names/ScottishMaleFirst.rb +13 -12
  37. data/lib/randomperson/Names/ScottishPrefix.rb +10 -16
  38. data/lib/randomperson/Names/SpanishFemaleFirst.rb +11 -10
  39. data/lib/randomperson/Names/SpanishLast.rb +15 -12
  40. data/lib/randomperson/Names/SpanishMaleFirst.rb +12 -11
  41. data/lib/randomperson/Names/SpanishPrefix.rb +17 -19
  42. data/lib/randomperson/Names/SwedishFemaleFirst.rb +10 -9
  43. data/lib/randomperson/Names/SwedishLast.rb +10 -9
  44. data/lib/randomperson/Names/SwedishMaleFirst.rb +15 -14
  45. data/lib/randomperson/Names/ThaiFemaleFirst.rb +9 -8
  46. data/lib/randomperson/Names/ThaiFirst.rb +9 -8
  47. data/lib/randomperson/Names/ThaiLast.rb +9 -8
  48. data/lib/randomperson/Names/ThaiMaleFirst.rb +9 -8
  49. data/lib/randomperson/Names/ThaiRomanisedFemaleFirst.rb +10 -9
  50. data/lib/randomperson/Names/ThaiRomanisedLast.rb +11 -10
  51. data/lib/randomperson/Names/ThaiRomanisedMaleFirst.rb +10 -9
  52. data/lib/randomperson/Names/WelshFemaleFirst.rb +9 -8
  53. data/lib/randomperson/Names/WelshLast.rb +11 -10
  54. data/lib/randomperson/Names/WelshMaleFirst.rb +9 -8
  55. data/lib/randomperson/Names/WelshPrefix.rb +10 -16
  56. data/lib/randomperson/Outputter.rb +53 -0
  57. data/lib/randomperson/demographic.rb +75 -0
  58. data/lib/randomperson/ext/Array.rb +6 -2
  59. data/lib/randomperson/generator.rb +54 -77
  60. data/lib/randomperson/name.rb +18 -13
  61. data/lib/randomperson/person.rb +2 -0
  62. data/lib/randomperson/version.rb +1 -1
  63. data/lib/randomperson.rb +126 -1
  64. data/spec/AmericanSuffix_spec.rb +37 -0
  65. data/spec/AnyLast_spec.rb +25 -0
  66. data/spec/Last_and_First_Names_spec.rb +113 -0
  67. data/spec/array_spec.rb +49 -0
  68. data/spec/demographic_spec.rb +15 -0
  69. data/spec/generator_spec.rb +1 -4
  70. data/spec/name_spec.rb +3 -2
  71. data/spec/randomperson_spec.rb +321 -0
  72. data/spec/rspec_helper.rb +22 -0
  73. data/spec/support/helpers.rb +13 -0
  74. data/spec/support/matchers/all.rb +14 -0
  75. data/spec/support/matchers/be_in.rb +9 -0
  76. data/spec/support/shared_examples/names.rb +59 -0
  77. data/test/benchmarks/concat_or_add.rb +30 -0
  78. data/test/benchmarks/my_assoc_or_select.rb +60 -0
  79. data.tar.gz.sig +0 -0
  80. metadata +35 -7
  81. metadata.gz.sig +2 -3
  82. data/README +0 -324
  83. data/lib/randomperson/choice.rb +0 -113
  84. data/spec/choice_spec.rb +0 -13
@@ -1,24 +1,25 @@
1
1
  # encoding: UTF-8
2
2
 
3
+ require_relative "../name.rb"
4
+ require_relative "../ext/Array.rb"
5
+
3
6
  module RandomPerson
4
7
  module Names
5
8
 
6
9
  class BasqueFemaleFirst < Name
7
10
 
8
11
  def initialize
9
- @formats = {
10
- :single => ->(n){ n.rand },
11
- }
12
-
12
+ @names = Names
13
+ @formats = [
14
+ ->(n){ n.rand },
15
+ ]
13
16
  @formats_ratiod = [ 0..99 ]
14
- setupnames
17
+ super
15
18
  end
16
19
 
17
- def setupnames
18
- @names = %w{ Agurtzane Ainhoa Aintzane Alazne Alize Amaia Ametza Andere Angelu Apala Argi Arima Arrosa Artizar Berezi Bihotz Catalin Dominica Edurne Elizabete Eneca Fede Gotzone Graciosa Guerechene Iñiga Katerin Kattalin Lide Lili Maitagarri Maite Maitea Margaita Mirari Therese Udaberri Ximena Yuana Zaballa Zeru Zurina Zuriñe }
19
- end
20
+ Names = %w{ Agurtzane Ainhoa Aintzane Alazne Alize Amaia Ametza Andere Angelu Apala Argi Arima Arrosa Artizar Berezi Bihotz Catalin Dominica Edurne Elizabete Eneca Fede Gotzone Graciosa Guerechene Iñiga Katerin Kattalin Lide Lili Maitagarri Maite Maitea Margaita Mirari Therese Udaberri Ximena Yuana Zaballa Zeru Zurina Zuriñe }
20
21
 
21
22
  end
22
23
  end
23
24
  end
24
-
25
+
@@ -1,22 +1,23 @@
1
1
  # encoding: UTF-8
2
2
 
3
+ require_relative "../name.rb"
4
+ require_relative "../ext/Array.rb"
5
+
3
6
  module RandomPerson
4
7
  module Names
5
8
 
6
9
  class BasqueLast < Name
7
10
 
8
11
  def initialize
9
- @formats = {
10
- :double_barrelled => ->(n){ n.rand + ' ' + n.rand },
11
- }
12
-
12
+ @names = Names
13
+ @formats = [
14
+ ->(n){ n.rand + ' ' + n.rand },
15
+ ]
13
16
  @formats_ratiod = [ 0..99 ]
14
- setupnames
17
+ super
15
18
  end
16
19
 
17
- def setupnames
18
- @names = %w{ Agirre Aguirre Alberdi Allende Alsogaray Alurralde Amézaga Arana Aráoz Araya Archuleta Arismendi Armendáriz Arriaga Arrieta Ayala Ayala Azcárraga Azcárate Azua Barrios Bengoechea Bolívar Buenechea Caínzos Camus Cano Caro Carranza Carrera Duhalde Echenique Echevarria Echeverría Elissalde Elizalde Elizondo Esparza Esquivel Etcheverry Etxeberria Eyzaguirre Garay García Garmendia Goicoechea Gorostiaga Goya Goyeneche Ibarra Landa Larraín Loyola Mendieta Mendoza Montoya Mujica Murua Ochoa Oñate Orozco Palacio Salazar Saldívar Solano Ugalde Ugarte Urbina Uribe Urquiza Urrutia Ursúa Velasco Vergara Vizcaino Vizcarra Xavier Ybarra Zabala Zaldívar Zavaleta Zúñiga Zurita }
19
- end
20
+ Names = %w{ Agirre Aguirre Alberdi Allende Alsogaray Alurralde Amézaga Arana Aráoz Araya Archuleta Arismendi Armendáriz Arriaga Arrieta Ayala Ayala Azcárraga Azcárate Azua Barrios Bengoechea Bolívar Buenechea Caínzos Camus Cano Caro Carranza Carrera Duhalde Echenique Echevarria Echeverría Elissalde Elizalde Elizondo Esparza Esquivel Etcheverry Etxeberria Eyzaguirre Garay García Garmendia Goicoechea Gorostiaga Goya Goyeneche Ibarra Landa Larraín Loyola Mendieta Mendoza Montoya Mujica Murua Ochoa Oñate Orozco Palacio Salazar Saldívar Solano Ugalde Ugarte Urbina Uribe Urquiza Urrutia Ursúa Velasco Vergara Vizcaino Vizcarra Xavier Ybarra Zabala Zaldívar Zavaleta Zúñiga Zurita }
20
21
  end
21
22
  end
22
23
  end
@@ -1,23 +1,24 @@
1
1
  # encoding: UTF-8
2
2
 
3
+ require_relative "../name.rb"
4
+ require_relative "../ext/Array.rb"
5
+
3
6
  module RandomPerson
4
7
  module Names
5
8
 
6
9
  class BasqueMaleFirst < Name
7
10
 
8
11
  def initialize
9
- @formats = {
10
- :single => ->(n){ n.rand },
11
- }
12
-
12
+ @names = Names
13
+ @formats = [
14
+ ->(n){ n.rand },
15
+ ]
13
16
  @formats_ratiod = [ 0..99 ]
14
- setupnames
17
+ super
15
18
  end
16
19
 
17
- def setupnames
18
- @names = %w{ Abarron Aingeru Aïtor Alesander Ander Antton Apal Aresti Asentzio Balendin Barea Basa-Jaun Belasco Beñat Bernat Bingen Bittor Bixente Danel Domeka Edorta Edrigu Ekaitz Elazar Eli Endika Eneco Erramun Estebe Gabirel Gaizka Gero Gorka Gotzon Guerechen Imanol Iñigo Ion Izar Jakome Joanes Jokin Joseba Julen Koldo Koldobika Lertxun Lizardi Markel Marko Mattin Mikel Mitxel Nikola Patxi Paulo Salbatore Sendoa Todor Tubal Txomin Umea Xabier Xalbador Xarles Xaviar Xavier Xemen Ximun Yorge Yuli Zeru Zigor Zuhaitz Zuri }
19
- end
20
+ Names = %w{ Abarron Aingeru Aïtor Alesander Ander Antton Apal Aresti Asentzio Balendin Barea Basa-Jaun Belasco Beñat Bernat Bingen Bittor Bixente Danel Domeka Edorta Edrigu Ekaitz Elazar Eli Endika Eneco Erramun Estebe Gabirel Gaizka Gero Gorka Gotzon Guerechen Imanol Iñigo Ion Izar Jakome Joanes Jokin Joseba Julen Koldo Koldobika Lertxun Lizardi Markel Marko Mattin Mikel Mitxel Nikola Patxi Paulo Salbatore Sendoa Todor Tubal Txomin Umea Xabier Xalbador Xarles Xaviar Xavier Xemen Ximun Yorge Yuli Zeru Zigor Zuhaitz Zuri }
20
21
 
21
22
  end
22
23
  end
23
- end
24
+ end
@@ -1,29 +1,23 @@
1
1
  # encoding: UTF-8
2
2
 
3
+ require_relative "../name.rb"
4
+ require_relative "../ext/Array.rb"
5
+
3
6
  module RandomPerson
4
7
  module Names
5
8
 
6
9
  class BritishPrefix < Name
10
+
11
+ Names = %w(Mr Dr Mrs Ms Miss)
7
12
 
8
13
  def initialize
9
-
14
+ @names = Names
10
15
  @formats_ratiod = [ 0..47, 48..49, 50..70, 71..87, 88..99]
11
-
12
- @names = %w(Mr Dr Mrs Ms Miss)
16
+ @possibles = Hash[ @formats_ratiod.zip @names ]
17
+
18
+ @on_execute = for_prefixes( 'Miss', 'Mr' )
13
19
  end
14
20
 
15
- def execute( person )
16
-
17
- if person.age < 17
18
- return @names[4] if person.gender == 'f'
19
- return @names[0]
20
- end
21
-
22
- r = rand(100) #0..99
23
-
24
- i = @formats_ratiod.index_in_range( r )
25
- return @names[i]
26
- end
27
21
  end
28
22
  end
29
- end
23
+ end
@@ -1,28 +1,33 @@
1
+ # encoding: UTF-8
2
+
3
+ require_relative "../name.rb"
4
+ require_relative "../ext/Array.rb"
5
+
1
6
  module RandomPerson
2
7
  module Names
3
8
 
4
9
  class BritishSuffix < Name
10
+
11
+ Names = %w( OBE MBE GBE KBE DBE CBE JP GM PhD BSc BA )
5
12
 
6
13
  def initialize
7
- @formats = {
8
-
9
- }
10
-
11
- @formats_ratiod = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9..59, 59..159]
12
-
13
- @names = %w( OBE, MBE, GBE, KBE, DBE, CBE, JP, GM, PhD BSc, BA )
14
- end
15
-
16
- def execute( person )
17
- retval = nil
18
- r = rand(999)
19
- unless person.age < 17 #sorry kids, but you ain't gonna get these
20
- i = @formats_ratiod.index_in_range( r )
21
- retval = @names[i] unless i.nil?
14
+ @names = Names
15
+ @formats = nil
16
+ @formats_ratiod = [ 0..0, 1..1, 2..2, 3..3, 4..4, 5..5, 6..6, 7..7, 8..8, 9..59, 59..159]
17
+ @possibles = Hash[ @formats_ratiod.zip @names ]
18
+
19
+ on_execute do |person|
20
+ unless person.age <= 16
21
+ r = rand(@formats_ratiod.last.end + 1 )
22
+ @possibles.each_pair{|k,v| break v if k === r }
23
+ else
24
+ ""
25
+ end
22
26
  end
23
27
 
24
- return retval
28
+ super
25
29
  end
30
+
26
31
  end
27
32
  end
28
33
  end
@@ -1,22 +1,23 @@
1
1
  # encoding: UTF-8
2
2
 
3
+ require_relative "../name.rb"
4
+ require_relative "../ext/Array.rb"
5
+
3
6
  module RandomPerson
4
7
  module Names
5
8
 
6
9
  class EnglishFemaleFirst < Name
7
10
 
8
11
  def initialize
9
- @formats = {
10
- :single => ->(n) { n.rand },
11
- }
12
-
12
+ @names = Names
13
+ @formats = [
14
+ ->(n) { n.rand },
15
+ ]
13
16
  @formats_ratiod = [ (0..99) ]
14
- setupnames
17
+ super
15
18
  end
16
19
 
17
- def setupnames
18
- @names = %w{ Aimee Aleksandra Alice Alicia Allison Alyssa Amy Andrea Angel Angela Ann Anna Anne Annie Ashley Barbara Beatrice Beth Betty Brenda Brooke Candace Cara Caren Carol Caroline Carolyn Carrie Cassandra Catherine Charlotte Chrissy Christen Christina Christine Christy Claire Claudia Courtney Crystal Cynthia Dana Danielle Deanne Deborah Deirdre Denise Diane Dianne Dorothy Eileen Elena Elizabeth Emily Erica Erin Frances Gina Giulietta Heather Helen Jane Janet Janice Jenna Jennifer Jessica Joanna Joyce Julia Juliana Julie Justine Kara Karen Katharine Katherine Kathleen Kathryn Katrina Kelly Kerry Kim Kimberly Kristen Kristina Kristine Laura Laurel Lauren Laurie Leah Linda Lisa Lori Marcia Margaret Maria Marie Marina Marisa Martha Mary Maya Melanie Melissa Michelle Monica Nancy Natalie Nicole Nina Pamela Patricia Rachel Rebecca Renee Sandra Sara Sharon Sheri Shirley Sonia Stefanie Stephanie Susan Suzanne Sylvia Tamara Tara Tatiana Terri Theresa Tiffany Tracy Valerie Veronica Vicky Vivian Wendy }
19
- end
20
+ Names = %w{ Aimee Aleksandra Alice Alicia Allison Alyssa Amy Andrea Angel Angela Ann Anna Anne Annie Ashley Barbara Beatrice Beth Betty Brenda Brooke Candace Cara Caren Carol Caroline Carolyn Carrie Cassandra Catherine Charlotte Chrissy Christen Christina Christine Christy Claire Claudia Courtney Crystal Cynthia Dana Danielle Deanne Deborah Deirdre Denise Diane Dianne Dorothy Eileen Elena Elizabeth Emily Erica Erin Frances Gina Giulietta Heather Helen Jane Janet Janice Jenna Jennifer Jessica Joanna Joyce Julia Juliana Julie Justine Kara Karen Katharine Katherine Kathleen Kathryn Katrina Kelly Kerry Kim Kimberly Kristen Kristina Kristine Laura Laurel Lauren Laurie Leah Linda Lisa Lori Marcia Margaret Maria Marie Marina Marisa Martha Mary Maya Melanie Melissa Michelle Monica Nancy Natalie Nicole Nina Pamela Patricia Rachel Rebecca Renee Sandra Sara Sharon Sheri Shirley Sonia Stefanie Stephanie Susan Suzanne Sylvia Tamara Tara Tatiana Terri Theresa Tiffany Tracy Valerie Veronica Vicky Vivian Wendy }
20
21
  end
21
22
  end
22
- end
23
+ end
@@ -1,23 +1,24 @@
1
1
  # encoding: UTF-8
2
2
 
3
+ require_relative "../name.rb"
4
+ require_relative "../ext/Array.rb"
5
+
3
6
  module RandomPerson
4
7
  module Names
5
8
 
6
9
  class EnglishLast < Name
7
10
 
8
11
  def initialize
9
- @formats = {
10
- :single => ->(n) { n.rand },
11
- :double_barrelled_hyphenated => ->(n) { n.rand + '-' + n.rand },
12
- }
13
-
14
- @formats_ratiod = [ (0..96), (97..99) ]
15
- setupnames
12
+ @names = Names
13
+ @formats = [
14
+ ->(n) { n.rand },
15
+ ->(n) { n.rand + '-' + n.rand },
16
+ ]
17
+ @formats_ratiod = [ 0..96, 97..99 ]
18
+ super
16
19
  end
17
20
 
18
- def setupnames
19
- @names = %w{ Smith Brown Taylor Johnson Walker Wright Robinson Thompson White Green Hall Wood Harris Martin Jackson Clarke Clark Turner Hill Cooper Ward Moore King Watson Baker Harrison Young Allen Mitchell Anderson Lee Bell Parker Davis Bennett Miller Cook Shaw Richardson Carter Collins Marshall Bailey Gray Cox Adams Wilkinson Foster Chapman Mason Russell Webb Rogers Hunt Mills Holmes Palmer Matthews Fisher Barnes Knight Harvey Barker Butler Jenkins Stevens Pearson Dixon Fletcher Hunter Howard Andrews Reynolds Elliott Fox Ford Saunders Payne West Day Pearce Brooks Bradley Dawson Walsh Lawrence Cole Atkinson Ball Spencer Armstrong Burton Booth Rose Webster Williamson Watts Hart Burns Wells }
20
- end
21
+ Names = %w{ Smith Brown Taylor Johnson Walker Wright Robinson Thompson White Green Hall Wood Harris Martin Jackson Clarke Clark Turner Hill Cooper Ward Moore King Watson Baker Harrison Young Allen Mitchell Anderson Lee Bell Parker Davis Bennett Miller Cook Shaw Richardson Carter Collins Marshall Bailey Gray Cox Adams Wilkinson Foster Chapman Mason Russell Webb Rogers Hunt Mills Holmes Palmer Matthews Fisher Barnes Knight Harvey Barker Butler Jenkins Stevens Pearson Dixon Fletcher Hunter Howard Andrews Reynolds Elliott Fox Ford Saunders Payne West Day Pearce Brooks Bradley Dawson Walsh Lawrence Cole Atkinson Ball Spencer Armstrong Burton Booth Rose Webster Williamson Watts Hart Burns Wells }
21
22
  end
22
23
  end
23
- end
24
+ end
@@ -1,22 +1,23 @@
1
1
  # encoding: UTF-8
2
2
 
3
+ require_relative "../name.rb"
4
+ require_relative "../ext/Array.rb"
5
+
3
6
  module RandomPerson
4
7
  module Names
5
8
 
6
9
  class EnglishMaleFirst < Name
7
10
 
8
11
  def initialize
9
- @formats = {
10
- :single => ->(n) { n.rand },
11
- }
12
-
12
+ @names = Names
13
+ @formats = [
14
+ ->(n) { n.rand },
15
+ ]
13
16
  @formats_ratiod = [ (0..99) ]
14
- setupnames
17
+ super
15
18
  end
16
19
 
17
- def setupnames
18
- @names = %w{ Jack Oliver Charlie Harry Alfie Thomas Joshua William James Daniel George Ethan Lewis Max Lucas Dylan Archie Joseph Jacob Samuel Liam Callum Oscar Jayden Logan Ryan Jake Tyler Riley Luke Harvey Ben Adam Alexander Benjamin Leo Matthew Noah Connor Alex Jamie Harrison Mason Cameron Owen Henry Nathan Finley Aaron Freddie Isaac Sam Finlay Theo Harley Aiden Toby Edward Rhys Michael Evan Kyle Leon Reece David Kai Ashton Bailey Kian Louis Taylor Hayden Brandon Joe Jay Luca Kayden Ewan Joel Sebastian Zac Ellis Josh Aidan John Billy Zak Bradley Kieran Blake Christopher Morgan Caleb Louie Andrew Bobby Gabriel Robert Elliot Jude }
19
- end
20
+ Names = %w{ Jack Oliver Charlie Harry Alfie Thomas Joshua William James Daniel George Ethan Lewis Max Lucas Dylan Archie Joseph Jacob Samuel Liam Callum Oscar Jayden Logan Ryan Jake Tyler Riley Luke Harvey Ben Adam Alexander Benjamin Leo Matthew Noah Connor Alex Jamie Harrison Mason Cameron Owen Henry Nathan Finley Aaron Freddie Isaac Sam Finlay Theo Harley Aiden Toby Edward Rhys Michael Evan Kyle Leon Reece David Kai Ashton Bailey Kian Louis Taylor Hayden Brandon Joe Jay Luca Kayden Ewan Joel Sebastian Zac Ellis Josh Aidan John Billy Zak Bradley Kieran Blake Christopher Morgan Caleb Louie Andrew Bobby Gabriel Robert Elliot Jude }
20
21
  end
21
22
  end
22
- end
23
+ end
@@ -1,27 +1,23 @@
1
+ # encoding: UTF-8
2
+
3
+ require_relative "../name.rb"
4
+ require_relative "../ext/Array.rb"
5
+
1
6
  module RandomPerson
2
7
  module Names
3
8
 
4
9
  class EnglishPrefix < Name
5
10
 
11
+ Names = %w(Mr Dr Mrs Ms Miss )
12
+
6
13
  def initialize
7
-
14
+ @names = Names
8
15
  @formats_ratiod = [ 0..47, 48..49, 50..70, 71..87, 88..99]
16
+ @possibles = Hash[ @formats_ratiod.zip @names ]
17
+ @on_execute = for_prefixes( 'Miss', 'Mr' )
9
18
 
10
- @names = %w(Mr Dr Mrs Ms Miss )
11
19
  end
12
20
 
13
- def execute( person )
14
-
15
- if person.age < 17
16
- return @names[4] if person.gender == 'f'
17
- return @names[0]
18
- end
19
-
20
- r = rand(100) #0..99
21
-
22
- i = @formats_ratiod.index_in_range( r )
23
- return @names[i]
24
- end
25
21
  end
26
22
  end
27
- end
23
+ end
@@ -1,24 +1,26 @@
1
1
  # encoding: UTF-8
2
2
 
3
+ require_relative "../name.rb"
4
+ require_relative "../ext/Array.rb"
5
+
3
6
  module RandomPerson
4
7
  module Names
5
8
 
6
9
  class FinnishFemaleFirst < Name
7
10
 
8
11
  def initialize
9
- @formats = {
10
- :single => ->(n) { n.rand },
11
- }
12
+ @names = Names
13
+ @formats = [
14
+ ->(n) { n.rand },
15
+ ]
12
16
 
13
17
  @formats_ratiod = [ (0..99) ]
14
- setupnames
18
+ super
15
19
  end
16
20
 
17
- def setupnames
18
- @names = %w{ Aino Anna Anneli Annikki Hannele Helena Johanna Kaarina Liisa Maria Marjatta Selma Tuuli }
19
- end
21
+ Names = %w{ Aino Anna Anni Anneli Annikki Hannele Helena Inari Johanna Kaarina Liisa Maria Marjatta Riikka Selma Tuuli }
20
22
  end
21
23
  end
22
24
  end
23
25
 
24
-
26
+
@@ -1,22 +1,23 @@
1
1
  # encoding: UTF-8
2
2
 
3
+ require_relative "../name.rb"
4
+ require_relative "../ext/Array.rb"
5
+
3
6
  module RandomPerson
4
7
  module Names
5
8
 
6
9
  class FinnishLast < Name
7
10
 
8
11
  def initialize
9
- @formats = {
10
- :single => ->(n) { n.rand }
11
- }
12
-
12
+ @names = Names
13
+ @formats = [
14
+ ->(n) { n.rand }
15
+ ]
13
16
  @formats_ratiod = [ (0..99) ]
14
- setupnames
17
+ super
15
18
  end
16
19
 
17
- def setupnames
18
- @names = %w( Heikkinen Hämäläinen Järvinen Korhonen Koskinen Laine Mäkelä Mäkinen Nieminen Virtanen )
19
- end
20
+ Names = %w( Heikkinen Hämäläinen Järvinen Korhonen Koskinen Laine Mäkelä Mäkinen Nieminen Virtanen )
20
21
 
21
22
  end
22
23
  end
@@ -1,26 +1,27 @@
1
1
  # encoding: UTF-8
2
2
 
3
+ require_relative "../name.rb"
4
+ require_relative "../ext/Array.rb"
5
+
3
6
  module RandomPerson
4
7
  module Names
5
8
 
6
9
  class FinnishMaleFirst < Name
7
10
 
8
11
  def initialize
9
- @formats = {
10
- :single => ->(n) { n.rand },
11
- }
12
-
12
+ @names = Names
13
+ @formats = [
14
+ ->(n) { n.rand },
15
+ ]
13
16
  @formats_ratiod = [ (0..99) ]
14
- setupnames
17
+ super
15
18
  end
16
19
 
17
- def setupnames
18
- @names = %w{ Antero Ilmari Johannes Juhani Kalevi Matti Mikael Olavi Tapani Tapio }
19
- end
20
+ Names = %w{ Antero Ilmari Johannes Juhani Kalevi Matti Mikael Olavi Tapani Tapio }
20
21
  end
21
22
  end
22
23
  end
23
24
 
24
25
 
25
26
 
26
-
27
+
@@ -1,29 +1,27 @@
1
1
  # encoding: UTF-8
2
2
 
3
+ require_relative "../name.rb"
4
+ require_relative "../ext/Array.rb"
5
+
3
6
  module RandomPerson
4
7
  module Names
5
8
 
6
9
  class FinnishPrefix < Name
10
+
11
+ Names = %w(herra Dr rouva neiti)
7
12
 
8
13
  def initialize
9
-
10
- @formats_ratiod = [ 0..47, 48..49, 50..69, 70..99]
14
+ @names = Names
15
+ @formats = [ nil ]
16
+ @formats_ratiod = [ 0..48, 49..50, 51..70, 71..99]
17
+ @possibles = Hash[ @formats_ratiod.zip @names ]
11
18
 
12
- @names = %w(herra Dr rouva neiti)
13
- end
19
+ @on_execute = for_prefixes( @names[3], @names.first )
20
+
21
+ end # initialize
14
22
 
15
- def execute( person )
16
-
17
- if person.age < 17
18
- return @names[3] if person.gender == 'f'
19
- return @names[0]
20
- end
21
-
22
- r = rand(100) #0..99
23
-
24
- i = @formats_ratiod.index_in_range( r )
25
- return @names[i]
26
- end
27
- end
23
+
24
+
25
+ end # class
28
26
  end
29
- end
27
+ end
@@ -1,23 +1,24 @@
1
1
  # encoding: UTF-8
2
2
 
3
+ require_relative "../name.rb"
4
+ require_relative "../ext/Array.rb"
5
+
3
6
  module RandomPerson
4
7
  module Names
5
8
 
6
9
  class FrenchFemaleFirst < Name
7
10
 
8
11
  def initialize
9
- @formats = {
10
- :single => ->(n) { n.rand },
11
- :double_barrelled_hyphenated => ->(n) { n.rand + '-' + n.rand },
12
- }
13
-
12
+ @names = Names
13
+ @formats = [
14
+ ->(n) { n.rand },
15
+ ->(n) { n.rand + '-' + n.rand },
16
+ ]
14
17
  @formats_ratiod = [ 0..70, 71..99 ]
15
- setupnames
18
+ super
16
19
  end
17
20
 
18
- def setupnames
19
- @names = %w{ Adélaïde Adèle Adrienne Agathe Agnès Aimée Alexandri Alix Alice Amélie Anaï Anastasie Andrée Anne Anou Antoinette Arnaud Astri Audrey Auréli Aurore Bernadett Brigitte Camill Capucine Caroline Catherine Cécile Céline Chanta Charlotte Christell Christian Christine Claire Claude Claudine Clémence Colett Constance Corinn Danielle Denise Diane Dominique Dorothée Édith Éléonore Élisabeth Élise Élodi Émilie Emmanuelle Florence Françoise Frédérique Gabrielle Genevièv Hélène Henriette Hortens Inès Isabelle Jacqueline Jeanne Jeannine Joséphine Josett Julie Juliette Laetitia Laure Laurenc Lorraine Louise Luce Madeleine Mano Marcell Margaux Marguerite Margot Marianne Marie Marine Marthe Martin Marys Mathilde Michèle Monique Nathalie Nath Nicole Noémi Océan Odett Olivie Patricia Paulett Pauline Pénélope Philippin Renée Sabin Simon Sophie Stéphanie Susanne Sylvie Thérèse Valentine Valérie Véronique Victoire Virginie Zoé }
20
- end
21
+ Names = %w{ Adélaïde Adèle Adrienne Agathe Agnès Aimée Alexandri Alix Alice Amélie Anaï Anastasie Andrée Anne Anou Antoinette Arnaud Astri Audrey Auréli Aurore Bernadett Brigitte Camill Capucine Caroline Catherine Cécile Céline Chanta Charlotte Christell Christian Christine Claire Claude Claudine Clémence Colett Constance Corinn Danielle Denise Diane Dominique Dorothée Édith Éléonore Élisabeth Élise Élodi Émilie Emmanuelle Florence Françoise Frédérique Gabrielle Genevièv Hélène Henriette Hortens Inès Isabelle Jacqueline Jeanne Jeannine Joséphine Josett Julie Juliette Laetitia Laure Laurenc Lorraine Louise Luce Madeleine Mano Marcell Margaux Marguerite Margot Marianne Marie Marine Marthe Martin Marys Mathilde Michèle Monique Nathalie Nath Nicole Noémi Océan Odett Olivie Patricia Paulett Pauline Pénélope Philippin Renée Sabin Simon Sophie Stéphanie Susanne Sylvie Thérèse Valentine Valérie Véronique Victoire Virginie Zoé }
21
22
  end
22
23
  end
23
24
  end
@@ -1,25 +1,26 @@
1
1
  # encoding: UTF-8
2
2
 
3
+ require_relative "../name.rb"
4
+ require_relative "../ext/Array.rb"
5
+
3
6
  module RandomPerson
4
7
  module Names
5
8
 
6
9
  class FrenchLast < Name
7
10
 
8
11
  def initialize
9
- @formats = {
10
- :single => ->(n) { n.rand },
11
- :de => ->(n) { 'de ' + n.rand },
12
- :du => ->(n) { 'du ' + n.rand },
13
- :double_barrelled_hyphenated => ->(n) { n.rand + '-' + n.rand },
14
- }
15
-
12
+ @names = Names
13
+ @formats = [
14
+ ->(n) { n.rand },
15
+ ->(n) { 'de ' + n.rand },
16
+ ->(n) { 'du ' + n.rand },
17
+ ->(n) { n.rand + '-' + n.rand },
18
+ ]
16
19
  @formats_ratiod = [ 0..79, 80..87, 88..96, 97..99 ]
17
- setupnames
20
+ super
18
21
  end
19
22
 
20
- def setupnames
21
- @names = %w{ Martin Bernard Thomas Petit Robert Richard Durand Dubois Moreau Laurent Simon Michel Lefebvre Leroy Roux David Bertrand Morel Fournier Girard Bonnet Dupont Lambert Fontaine Rousseau Vincent Muller Lefevre Faure Andre Mercier Blanc Guerin Boyer Garnier Chevalier Francois Legrand Gauthier Garcia Perrin Robin Clement Morin Nicolas Henry Roussel Mathieu Gautier Masson Marchand Duval Denis Dumont Marie Lemaire Noel Meyer Dufour Meunier Brun Blanchard Giraud Joly Riviere Lucas Brunet Gaillard Barbier Arnaud Martinez Gerard Roche Renard Schmitt Roy Leroux Colin Vidal Caron Picard Roger Fabre Aubert Lemoine Renaud Dumas Lacroix Olivier Philippe Bourgeois Pierre Benoit Rey Leclerc Payet Rolland Leclercq Guillaume Lecomte Lopez Jean Dupuy Guillot Hubert Berger Carpentier Sanchez Dupuis Moulin Louis Deschamps Huet Vasseur Perez Boucher Fleury Royer Klein Jacquet Adam Paris Poirier Marty Aubry Guyot Carre Charles Renault Charpentier Menard Maillard Baron Bertin Bailly Herve Schneider Fernandez Le\ Gall Collet Leger Bouvier Julien Prevost Millet Perrot Daniel Le\ Roux Cousin Germain Breton Besson Langlois Remy Le\ Goff Pelletier Leveque Perrier Leblanc Barre Lebrun Marchal Weber Mallet Hamon Boulanger Jacob Monnier Michaud Rodriguez Guichard Gillet Etienne Grondin Poulain Tessier Chevallier Collin Chauvin Da Silva Bouchet Gay Lemaitre Benard Marechal Humbert Reynaud Antoine Hoarau Perret Barthelemy Cordier Pichon Lejeune Gilbert Lamy Delaunay Pasquier Carlier Laporte Gros Buisson Ollivier Briand Alexandre Georges Guillou Besnard Legros Gonzalez Coulon Maillot Albert Camus Delattre Launay Hebert Lesage Blanchet Didier Voisin Pons Bousquet Coste Vallee Jacques Martel Maury Raynaud Barbe Pascal Bigot Verdier Charrier Sauvage Guillet Mahe Leduc Lelievre Gregoire Joubert Masse Delmas Morvan Lebreton Tanguy Pineau Lebon Gaudin Colas Imbert Paul Raymond Guillon Brunel Regnier Ferrand Hardy Devaux Courtois Bodin Chauvet Allard Blondel Laine Delorme Seguin Lenoir Berthelot Bonneau Pereira Thibault Lacombe Riou Lagarde Clerc Bruneau Godard Vaillant Couturier Gomez Jourdan Pages Valentin Lombard Mary Blin Texier Rossi Marion Allain Maurice Guilbert Baudry Dupre Marin Evrard Hoareau Turpin Bourdon Lefort Legendre Chartier Gilles Lacoste Loiseau Duhamel Laroche Ferreira Rousset Toussaint Wagner Fischer Normand Maillet Guibert Labbe Bazin Rocher Bonnin Merle Jacquot Grenier Valette Leconte Peltier Pruvost Auger Vallet Pottier Descamps Parent Boutin Potier Chauveau Martineau Hernandez Neveu Peron Delahaye Vial Blot Delage Lemonnier Petitjean Maurin Rodrigues Cros Lafon Faivre Chretien Fouquet Serre Favre Becker Foucher Guyon Joseph Mace Dos Santos Gallet Charbonnier Bouvet Salmon Le\ Corre Fernandes Bernier Rossignol Delannoy Levy Prigent Lecoq Thierry Cornu Girault Jourdain Begue Andrieu Maurel Ruiz Parmentier Guy Laborde Gras Goncalves Castel Gervais Boulay Chapuis Samson Duclos Dijoux Chambon Stephan Sabatier Poncet Besse Weiss Doucet Bonhomme Hamel Berthier Letellier Prevot Grand Grandjean Benoist Leblond Gosselin Leleu Comte Favier Bellanger Martinet Billard Rault Geoffroy Forestier Blondeau Roques Ricard Pommier Boulet Drouet Poisson Maire Mounier Gueguen Combes Huguet Morand Leonard Ledoux Prat Dubreuil Fortin Ferre Rigaud Brossard Picot Granger Merlin Laval Claude Marquet Mouton Brault Jeanne Marc Levasseur Le\ Roy Guillemin Bocquet Constant Pujol Lavigne Bauer Hoffmann Chatelain Lacour Jung Jamet Lallemand Walter Basset Provost Salaun Tellier Gibert Martins Rose Navarro Grange Lepage Bouquet Keller Techer Jolly Tournier Guillard Papin Bataille Lelong Cartier Leon Champion Dujardin Dumoulin Lasserre Flament Husson Schmidt Le\ Bihan Kieffer Millot Le\ Guen Ferry Bourdin Mangin Gicquel Cadet Soulier Mignot Barret Bureau Leray Fort Barreau Mas Lafont Bouchard Jolivet Savary Foulon Guillemot Costa Armand Blaise Binet Montagne }
22
- end
23
+ Names = %w{ Martin Bernard Thomas Petit Robert Richard Durand Dubois Moreau Laurent Simon Michel Lefebvre Leroy Roux David Bertrand Morel Fournier Girard Bonnet Dupont Lambert Fontaine Rousseau Vincent Muller Lefevre Faure Andre Mercier Blanc Guerin Boyer Garnier Chevalier Francois Legrand Gauthier Garcia Perrin Robin Clement Morin Nicolas Henry Roussel Mathieu Gautier Masson Marchand Duval Denis Dumont Marie Lemaire Noel Meyer Dufour Meunier Brun Blanchard Giraud Joly Riviere Lucas Brunet Gaillard Barbier Arnaud Martinez Gerard Roche Renard Schmitt Roy Leroux Colin Vidal Caron Picard Roger Fabre Aubert Lemoine Renaud Dumas Lacroix Olivier Philippe Bourgeois Pierre Benoit Rey Leclerc Payet Rolland Leclercq Guillaume Lecomte Lopez Jean Dupuy Guillot Hubert Berger Carpentier Sanchez Dupuis Moulin Louis Deschamps Huet Vasseur Perez Boucher Fleury Royer Klein Jacquet Adam Paris Poirier Marty Aubry Guyot Carre Charles Renault Charpentier Menard Maillard Baron Bertin Bailly Herve Schneider Fernandez Le\ Gall Collet Leger Bouvier Julien Prevost Millet Perrot Daniel Le\ Roux Cousin Germain Breton Besson Langlois Remy Le\ Goff Pelletier Leveque Perrier Leblanc Barre Lebrun Marchal Weber Mallet Hamon Boulanger Jacob Monnier Michaud Rodriguez Guichard Gillet Etienne Grondin Poulain Tessier Chevallier Collin Chauvin Da Silva Bouchet Gay Lemaitre Benard Marechal Humbert Reynaud Antoine Hoarau Perret Barthelemy Cordier Pichon Lejeune Gilbert Lamy Delaunay Pasquier Carlier Laporte Gros Buisson Ollivier Briand Alexandre Georges Guillou Besnard Legros Gonzalez Coulon Maillot Albert Camus Delattre Launay Hebert Lesage Blanchet Didier Voisin Pons Bousquet Coste Vallee Jacques Martel Maury Raynaud Barbe Pascal Bigot Verdier Charrier Sauvage Guillet Mahe Leduc Lelievre Gregoire Joubert Masse Delmas Morvan Lebreton Tanguy Pineau Lebon Gaudin Colas Imbert Paul Raymond Guillon Brunel Regnier Ferrand Hardy Devaux Courtois Bodin Chauvet Allard Blondel Laine Delorme Seguin Lenoir Berthelot Bonneau Pereira Thibault Lacombe Riou Lagarde Clerc Bruneau Godard Vaillant Couturier Gomez Jourdan Pages Valentin Lombard Mary Blin Texier Rossi Marion Allain Maurice Guilbert Baudry Dupre Marin Evrard Hoareau Turpin Bourdon Lefort Legendre Chartier Gilles Lacoste Loiseau Duhamel Laroche Ferreira Rousset Toussaint Wagner Fischer Normand Maillet Guibert Labbe Bazin Rocher Bonnin Merle Jacquot Grenier Valette Leconte Peltier Pruvost Auger Vallet Pottier Descamps Parent Boutin Potier Chauveau Martineau Hernandez Neveu Peron Delahaye Vial Blot Delage Lemonnier Petitjean Maurin Rodrigues Cros Lafon Faivre Chretien Fouquet Serre Favre Becker Foucher Guyon Joseph Mace Dos Santos Gallet Charbonnier Bouvet Salmon Le\ Corre Fernandes Bernier Rossignol Delannoy Levy Prigent Lecoq Thierry Cornu Girault Jourdain Begue Andrieu Maurel Ruiz Parmentier Guy Laborde Gras Goncalves Castel Gervais Boulay Chapuis Samson Duclos Dijoux Chambon Stephan Sabatier Poncet Besse Weiss Doucet Bonhomme Hamel Berthier Letellier Prevot Grand Grandjean Benoist Leblond Gosselin Leleu Comte Favier Bellanger Martinet Billard Rault Geoffroy Forestier Blondeau Roques Ricard Pommier Boulet Drouet Poisson Maire Mounier Gueguen Combes Huguet Morand Leonard Ledoux Prat Dubreuil Fortin Ferre Rigaud Brossard Picot Granger Merlin Laval Claude Marquet Mouton Brault Jeanne Marc Levasseur Le\ Roy Guillemin Bocquet Constant Pujol Lavigne Bauer Hoffmann Chatelain Lacour Jung Jamet Lallemand Walter Basset Provost Salaun Tellier Gibert Martins Rose Navarro Grange Lepage Bouquet Keller Techer Jolly Tournier Guillard Papin Bataille Lelong Cartier Leon Champion Dujardin Dumoulin Lasserre Flament Husson Schmidt Le\ Bihan Kieffer Millot Le\ Guen Ferry Bourdin Mangin Gicquel Cadet Soulier Mignot Barret Bureau Leray Fort Barreau Mas Lafont Bouchard Jolivet Savary Foulon Guillemot Costa Armand Blaise Binet Montagne }
23
24
  end
24
25
  end
25
26
  end
@@ -1,27 +1,28 @@
1
1
  # encoding: UTF-8
2
2
 
3
+ require_relative "../name.rb"
4
+ require_relative "../ext/Array.rb"
5
+
3
6
  module RandomPerson
4
7
  module Names
5
8
 
6
9
  class FrenchMaleFirst < Name
7
10
 
8
11
  def initialize
9
- @formats = {
10
- :single => ->(n) { n.rand },
11
- :double_barrelled_hyphenated => ->(n) { n.rand + '-' + n.rand },
12
- }
13
-
12
+ @names = Names
13
+ @formats = [
14
+ ->(n) { n.rand },
15
+ ->(n) { n.rand + '-' + n.rand },
16
+ ]
14
17
  @formats_ratiod = [ 0..70, 71..99 ]
15
- setupnames
18
+ super
16
19
  end
17
20
 
18
- def setupnames
19
- @names = %w{ Adrien Aimé Alain Alexandre Alexi Alfred Alphonse Amaur André Antoine Anto Arnau Arthur Auguste Augustin Benjamin Benoît Bernard Bertrand Brun Charles Christia Christophe Claude Cyrille Daniel David Denis Didie Dominique Édouard Émile Emmanuel Éric Étienne Eugène Francis François Franck Frédéric Gabriel Gasto Georges Gérard Gilbert Gilles Grégoire Guillaume Guy Gustav Henri Honoré Hugues Isaac Jacques Jacquot Jean Jeannot Jérôme Joseph Jules Julien Laurent Léon Louis Luc Lucas Marc Marcel Martin Matthieu Maurice Michel Nicolas Noël Olivier Pasca Patrick Patrice Paul Philippe Pierre Raymond Rémy René Richard Robert Roger Roland Sébastien Serg Stéphane Théodore Théophile Thibaut Thierry Thomas Timothée Tristan Victor Vincent Xavier Yves Zacharie }
20
- end
21
+ Names = %w{ Adrien Aimé Alain Alexandre Alexi Alfred Alphonse Amaur André Antoine Anto Arnau Arthur Auguste Augustin Benjamin Benoît Bernard Bertrand Brun Charles Christia Christophe Claude Cyrille Daniel David Denis Didie Dominique Édouard Émile Emmanuel Éric Étienne Eugène Francis François Franck Frédéric Gabriel Gasto Georges Gérard Gilbert Gilles Grégoire Guillaume Guy Gustav Henri Honoré Hugues Isaac Jacques Jacquot Jean Jeannot Jérôme Joseph Jules Julien Laurent Léon Louis Luc Lucas Marc Marcel Martin Matthieu Maurice Michel Nicolas Noël Olivier Pasca Patrick Patrice Paul Philippe Pierre Raymond Rémy René Richard Robert Roger Roland Sébastien Serg Stéphane Théodore Théophile Thibaut Thierry Thomas Timothée Tristan Victor Vincent Xavier Yves Zacharie }
21
22
  end
22
23
  end
23
24
  end
24
25
 
25
26
 
26
27
 
27
-
28
+