opal-d3 0.0.20170205

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/Gemfile +3 -0
  4. data/README.md +7 -0
  5. data/Rakefile +31 -0
  6. data/d3.js +16393 -0
  7. data/demo/Gemfile +4 -0
  8. data/demo/README.md +7 -0
  9. data/demo/app/data/elections_2016.rb +10 -0
  10. data/demo/app/data/harry_potter.rb +19 -0
  11. data/demo/app/data/iphones.rb +29 -0
  12. data/demo/app/data/london_population.rb +26 -0
  13. data/demo/app/data/man_vs_horse.rb +55 -0
  14. data/demo/app/data/mtg_modern_colors.rb +96 -0
  15. data/demo/app/data/mtg_modern_creatures.rb +116 -0
  16. data/demo/app/data/olympics_2016_medals.rb +100 -0
  17. data/demo/app/data/paradox.rb +60 -0
  18. data/demo/app/data/polish_pms.rb +28 -0
  19. data/demo/app/data/star_trek_voyager.rb +183 -0
  20. data/demo/app/data/weather_in_london.rb +381 -0
  21. data/demo/app/elections_2016.rb +19 -0
  22. data/demo/app/harry_potter.rb +35 -0
  23. data/demo/app/iphones.rb +47 -0
  24. data/demo/app/london_population.rb +46 -0
  25. data/demo/app/london_population_area.rb +42 -0
  26. data/demo/app/man_vs_horse.rb +53 -0
  27. data/demo/app/mtg_modern_colors.rb +49 -0
  28. data/demo/app/mtg_modern_creatures.rb +63 -0
  29. data/demo/app/olympics_2016_medals.rb +54 -0
  30. data/demo/app/paradox.rb +57 -0
  31. data/demo/app/polish_pms.rb +53 -0
  32. data/demo/app/star_trek_voyager.rb +39 -0
  33. data/demo/app/weather_in_london.rb +62 -0
  34. data/demo/assets/d3.js +16393 -0
  35. data/demo/assets/style.css +0 -0
  36. data/demo/config.ru +39 -0
  37. data/demo/views/index.erb +21 -0
  38. data/demo/views/visualization.erb +29 -0
  39. data/lib/opal/d3/arc.rb +21 -0
  40. data/lib/opal/d3/area.rb +49 -0
  41. data/lib/opal/d3/axis.rb +77 -0
  42. data/lib/opal/d3/band_scale.rb +29 -0
  43. data/lib/opal/d3/collections.rb +10 -0
  44. data/lib/opal/d3/color.rb +78 -0
  45. data/lib/opal/d3/continuous_scale.rb +64 -0
  46. data/lib/opal/d3/creator.rb +11 -0
  47. data/lib/opal/d3/curve.rb +74 -0
  48. data/lib/opal/d3/dsv.rb +103 -0
  49. data/lib/opal/d3/ease.rb +319 -0
  50. data/lib/opal/d3/format.rb +97 -0
  51. data/lib/opal/d3/histograms.rb +44 -0
  52. data/lib/opal/d3/interpolate.rb +125 -0
  53. data/lib/opal/d3/line.rb +29 -0
  54. data/lib/opal/d3/map.rb +52 -0
  55. data/lib/opal/d3/misc.rb +15 -0
  56. data/lib/opal/d3/native.rb +84 -0
  57. data/lib/opal/d3/nest.rb +100 -0
  58. data/lib/opal/d3/ordinal_scale.rb +56 -0
  59. data/lib/opal/d3/path.rb +22 -0
  60. data/lib/opal/d3/pie.rb +23 -0
  61. data/lib/opal/d3/point_scale.rb +26 -0
  62. data/lib/opal/d3/polygon.rb +16 -0
  63. data/lib/opal/d3/quadtree.rb +95 -0
  64. data/lib/opal/d3/quantile_scale.rb +21 -0
  65. data/lib/opal/d3/quantize_scale.rb +23 -0
  66. data/lib/opal/d3/radial_area.rb +49 -0
  67. data/lib/opal/d3/radial_line.rb +29 -0
  68. data/lib/opal/d3/random.rb +12 -0
  69. data/lib/opal/d3/search.rb +28 -0
  70. data/lib/opal/d3/selection.rb +149 -0
  71. data/lib/opal/d3/sequential_scale.rb +96 -0
  72. data/lib/opal/d3/set.rb +33 -0
  73. data/lib/opal/d3/stack.rb +11 -0
  74. data/lib/opal/d3/statistics.rb +81 -0
  75. data/lib/opal/d3/symbol.rb +70 -0
  76. data/lib/opal/d3/threshold_scale.rb +23 -0
  77. data/lib/opal/d3/time_format.rb +48 -0
  78. data/lib/opal/d3/time_interval.rb +81 -0
  79. data/lib/opal/d3/transformations.rb +13 -0
  80. data/lib/opal/d3/version.rb +5 -0
  81. data/lib/opal/d3.rb +62 -0
  82. data/lib/opal-d3.rb +9 -0
  83. data/opal-d3.gemspec +20 -0
  84. data/spec/arc_spec.rb +86 -0
  85. data/spec/area_spec.rb +102 -0
  86. data/spec/axis_spec.rb +174 -0
  87. data/spec/band_scale_spec.rb +73 -0
  88. data/spec/color_spec.rb +74 -0
  89. data/spec/continuous_scale_spec.rb +217 -0
  90. data/spec/coverage_spec.rb +23 -0
  91. data/spec/creator_spec.rb +15 -0
  92. data/spec/curve_spec.rb +214 -0
  93. data/spec/dsv_spec.rb +194 -0
  94. data/spec/ease_spec.rb +370 -0
  95. data/spec/format_spec.rb +87 -0
  96. data/spec/histograms_spec.rb +61 -0
  97. data/spec/html/d3.js +16393 -0
  98. data/spec/html/index.html.erb +12 -0
  99. data/spec/interpolate_spec.rb +152 -0
  100. data/spec/line_spec.rb +58 -0
  101. data/spec/map_spec.rb +80 -0
  102. data/spec/misc_spec.rb +19 -0
  103. data/spec/nest_spec.rb +89 -0
  104. data/spec/objects_spec.rb +22 -0
  105. data/spec/ordinal_scale_spec.rb +59 -0
  106. data/spec/path_spec.rb +65 -0
  107. data/spec/pie_spec.rb +114 -0
  108. data/spec/point_scale_spec.rb +58 -0
  109. data/spec/polygon_spec.rb +51 -0
  110. data/spec/quadtree_spec.rb +128 -0
  111. data/spec/quantile_scale_spec.rb +24 -0
  112. data/spec/quantize_scale_spec.rb +40 -0
  113. data/spec/radial_area_spec.rb +127 -0
  114. data/spec/radial_line_spec.rb +54 -0
  115. data/spec/random_spec.rb +34 -0
  116. data/spec/search_spec.rb +69 -0
  117. data/spec/selection_data_spec.rb +71 -0
  118. data/spec/selection_manipulation_spec.rb +179 -0
  119. data/spec/selection_spec.rb +214 -0
  120. data/spec/sequential_scale_spec.rb +90 -0
  121. data/spec/set_spec.rb +57 -0
  122. data/spec/spec_helper.rb +2 -0
  123. data/spec/stack_spec.rb +23 -0
  124. data/spec/statistics_spec.rb +65 -0
  125. data/spec/symbol_spec.rb +121 -0
  126. data/spec/threshold_scale_spec.rb +28 -0
  127. data/spec/time_format_spec.rb +99 -0
  128. data/spec/time_interval_spec.rb +304 -0
  129. data/spec/transformations_spec.rb +51 -0
  130. metadata +258 -0
data/demo/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "sinatra"
4
+ gem "opal-d3", path: ".."
data/demo/README.md ADDED
@@ -0,0 +1,7 @@
1
+ To give it a try:
2
+
3
+ ```
4
+ cd demo
5
+ bundle install
6
+ bundle exec rackup
7
+ ```
@@ -0,0 +1,10 @@
1
+ require "ostruct"
2
+
3
+ Elections2016 = [
4
+ { name: "Donald Trump", votes: 62_979_879, color: "#ff8c00" },
5
+ { name: "Hillary Clinton", votes: 65_844_954, color: "#98abc5" },
6
+ { name: "Gary Johnson", votes: 4_488_919, color: "#8a89a6" },
7
+ { name: "Jill Stein", votes: 1_457_044, color: "#7b6888" },
8
+ { name: "Evan McMullin", votes: 725_902, color: "#6b486b" },
9
+ { name: "Darrell Castle", votes: 202_979, color: "#a05d56" },
10
+ ].map{|o| OpenStruct.new(o) }
@@ -0,0 +1,19 @@
1
+ require "ostruct"
2
+ require "time"
3
+
4
+ # Pages for UK releases, according to Harry Potter wikia
5
+ HarryPotterBooks = [
6
+ ["Philosopher's Stone", "1997-06-26", 223],
7
+ ["Chamber of Secrets", "1998-07-02", 251],
8
+ ["Prisoner of Azkaban", "1999-07-08", 317],
9
+ ["Goblet of Fire", "2000-07-08", 636],
10
+ ["Order of the Phoenix", "2003-06-21", 766],
11
+ ["Half-Blood Prince", "2005-07-16", 607],
12
+ ["Deathly Hallows", "2007-07-21", 610],
13
+ ].map do |title, time, pages|
14
+ OpenStruct.new(
15
+ title: title,
16
+ date: Time.parse(time),
17
+ pages: pages
18
+ )
19
+ end
@@ -0,0 +1,29 @@
1
+ require "date"
2
+ require "time"
3
+ require "ostruct"
4
+
5
+ IPhones = [
6
+ ["iPhone", "2007-06-29", [4,8,16]],
7
+ ["iPhone 3G", "2008-07-11", [8,16]],
8
+ ["iPhone 3GS", "2009-06-19", [8,16,32]],
9
+ ["iPhone 4", "2010-06-24", [8,16,32]],
10
+ ["iPhone 4S", "2011-10-14", [8,16,32,64]],
11
+ ["iPhone 5", "2012-09-21", [16,32,64]],
12
+ ["iPhone 5C", "2013-09-20", [8,16,32]],
13
+ ["iPhone 5S", "2013-09-20", [16,32,64]],
14
+ ["iPhone 6", "2014-09-19", [16,64,128]],
15
+ ["iPhone 6 Plus", "2014-09-19", [16,64,128]],
16
+ ["iPhone 6S", "2015-09-25", [16,32,64,128]],
17
+ ["iPhone 6S Plus", "2015-09-25", [16,32,64,128]],
18
+ ["iPhone SE", "2016-03-31", [16,64]],
19
+ ["iPhone 7", "2016-09-16", [32,128,256]],
20
+ ["iPhone 7 Plus", "2016-09-16", [32,128,256]],
21
+ ].map{|n,d,s|
22
+ OpenStruct.new(name: n, released: Time.parse(d), sizes: s)
23
+ }
24
+
25
+ IPhoneVariants = IPhones.flat_map do |i|
26
+ i.sizes.map do |sz|
27
+ OpenStruct.new(name: i.name, released: i.released, size: sz)
28
+ end
29
+ end
@@ -0,0 +1,26 @@
1
+ require "ostruct"
2
+
3
+ LondonPopulation = [
4
+ {"year": 1801, "inner": 879491, "outer": 131666, "greater": 1011157 },
5
+ {"year": 1811, "inner": 1040033, "outer": 157640, "greater": 1197673 },
6
+ {"year": 1821, "inner": 1263975, "outer": 186147, "greater": 1450122 },
7
+ {"year": 1831, "inner": 1515557, "outer": 214392, "greater": 1729949 },
8
+ {"year": 1841, "inner": 1661346, "outer": 255667, "greater": 1917013 },
9
+ {"year": 1851, "inner": 1995846, "outer": 290763, "greater": 2286609 },
10
+ {"year": 1861, "inner": 2634143, "outer": 460248, "greater": 3094391 },
11
+ {"year": 1871, "inner": 3272441, "outer": 629737, "greater": 3902178 },
12
+ {"year": 1881, "inner": 3910735, "outer": 799225, "greater": 4709960 },
13
+ {"year": 1891, "inner": 4422340, "outer": 1143516, "greater": 5565856 },
14
+ {"year": 1901, "inner": 4670177, "outer": 1556317, "greater": 6226494 },
15
+ {"year": 1911, "inner": 4997741, "outer": 2160134, "greater": 7157875 },
16
+ {"year": 1921, "inner": 4936803, "outer": 2616723, "greater": 7553526 },
17
+ {"year": 1931, "inner": 4887932, "outer": 3211010, "greater": 8098942 },
18
+ {"year": 1941, "inner": 4224135, "outer": 3763801, "greater": 7987936 },
19
+ {"year": 1951, "inner": 3680821, "outer": 4483595, "greater": 8164416 },
20
+ {"year": 1961, "inner": 3336557, "outer": 4444785, "greater": 7781342 },
21
+ {"year": 1971, "inner": 3030490, "outer": 4418694, "greater": 7449184 },
22
+ {"year": 1981, "inner": 2425534, "outer": 4182979, "greater": 6608513 },
23
+ {"year": 1991, "inner": 2625245, "outer": 4262035, "greater": 6887280 },
24
+ {"year": 2001, "inner": 2765975, "outer": 4406061, "greater": 7172036 },
25
+ {"year": 2011, "inner": 3231900, "outer": 4942100, "greater": 8173900 },
26
+ ].map{|o| OpenStruct.new(o)}
@@ -0,0 +1,55 @@
1
+ require "ostruct"
2
+
3
+ ManVsHorse = [
4
+ [2016, "Horse", "Lindsey Walters", "Deliva Crianza", "2:17:58", "Ross MacDonald", "2:37:51"],
5
+ [2015, "Horse", "Geoffrey Allen", "Leo", "2:20:46", "Hugh Aggleton", "2:30:35"],
6
+ [2014, "Horse", "Geoffrey Allen", "Leo", "2:22:53", "Jonathan Albon", "2:42:49"],
7
+ [2013, "Horse", "Beti Gordon", "Next in line Grangeway", "2:18:03", "Hugh Aggleton", "2:46:25"],
8
+ [2012, "Horse", "Iola Evans", "Rheidol Star", "2:00:51", "Huw Lobb", "2:25:57"],
9
+ [2011, "Horse", "Beti Gordon", "Next in line Grangeway", "2:08:37", "Charlie Pearson", "2:25:45"],
10
+ [2010, "Horse", "Llinos Mair Jones", "Sly Dai", "2:07:04", "Haggai Chepkwony", "2:17:27"],
11
+ [2009, "Horse", "Geoffrey Allen", "Dukes Touch of Fun", "2:11:43", "Martin Cox", "2:20:02"],
12
+ [2008, "Horse", "Geoffrey Allen", "Dukes Touch of Fun", "2:18:13", "John Macfarlane", "2:18:43"],
13
+ [2007, "Human", "Geoffrey Allen", "Lucy", "2:31:26", "Florian Holzinger", "2:20:30"],
14
+ [2006, "Horse", "Denise Meldrum", "Tarran Bay", "2:10:29", "Haggai Chepkwony", "2:19:06"],
15
+ [2005, "Horse", "Lise Cooke", "Gifted Lady", "2:19:11", "Stephen Goulding", "2:33:22"],
16
+ [2004, "Human", "Zoe White", "Kay Bee Jay", "2:07:36", "Huw Lobb", "2:05:19"],
17
+ [2003, "Horse", "Robyn Petrie-Ritchie", "Druimguiga Shemal", "2:02:01", "Mark Croasdale", "2:19:02"],
18
+ [2002, "Horse", "Robyn Petrie-Ritchie", "Druimguiga Shemal", "2:02:23", "James McQueen", "2:18:52"],
19
+ [2001, "Horse", "Heather Evans", "Royal Mikado", "2:08:06", "Martin Cox", "2:17:17"],
20
+ [2000, "Horse", "Heather Evans", "Royal Mikado", "2:08", "Mark Croasdale", "2:10"],
21
+ [1999, "Horse", "Jackie Gilmour", "Ruama", "1:58", "Mark Palmer", "2:16"],
22
+ [1998, "Horse", "Jackie Gilmour", "Ruama", "1:46", "Stuart Major", "2:16"],
23
+ [1997, "Horse", "Megan Lewis", "unknown", "1:52", "Paul Cadwallader", "2:09"],
24
+ [1996, "Horse", "Ken Mapp", "Ahmaar", "1:57", "Mark Palmer", "2:12"],
25
+ [1995, "Horse", "Ken Mapp", "Ahmaar", "1:57", "Paul Cadwallader", "2:06"],
26
+ [1994, "Horse", "Celia Tymons", "Eskalabar", "1:52", "Mark Croasdale", "2:09"],
27
+ [1993, "Horse", "John Hudson", "unknown", "1:47", "Robin Bergstrand", "2:03"],
28
+ [1992, "Horse", "Zoe Jennings", "Hussar", "1:38", "Derek Green", "2:09"],
29
+ [1991, "Horse", "Zoe Jennings", "Hussar", "1:30", "Mark Croasdale", "2:05"],
30
+ [1990, "Horse", "Ray Jenkins", "The Doid", "1:36", "Glyn Williams", "2:07"],
31
+ [1989, "Horse", "Ray Jenkins", "The Doid", "1:54", "Mark Croasdale", "2:10"],
32
+ [1988, "Horse", "John Davies", "Mavies", "1:47", "Mark Croasdale", "2:08"],
33
+ [1987, "Horse", "Ray Jenkins", "The Doid", "1:32", "Paul Wheeler", "1:57"],
34
+ [1986, "Horse", "Nia Tudno-Jones", "Jenny", "1:44", "Fuselier Hughes", "2:08"],
35
+ [1985, "Horse", "Nia Tudno-Jones", "Jenny", "1:40", "David Woodhead", "2:08"],
36
+ [1984, "Horse", "William Jones", "Solitaire", "1:20", "David Woodhead", "2:05"],
37
+ [1983, "Horse", "Ann Thomas", "Nutmeg", "1:26", "Dic Evans", "2:02"],
38
+ [1982, "Horse", "Sue Thomas", "Simon", "2:06", "Paul Brownson", "2:10"],
39
+ [1981, "Horse", "Clive Powell", "Sultan", "2:02", "Dic Evans", "2:24"],
40
+ [1980, "Horse", "Glyn Jones", "Solomon", "1:27", "Dic Evans", "2:10"],
41
+ ].map{|y,w,rn,hn,ht,mn,mt|
42
+ h,m,s = ht.split(":").map(&:to_i)
43
+ ht = h*60+m+(s||0)
44
+ h,m,s = mt.split(":").map(&:to_i)
45
+ mt = h*60+m+(s||0)
46
+ OpenStruct.new(
47
+ year: y,
48
+ winner: w,
49
+ rider: rn,
50
+ horse: hn,
51
+ horse_time: ht,
52
+ human: mn,
53
+ human_time: mt,
54
+ )
55
+ }
@@ -0,0 +1,96 @@
1
+ require "ostruct"
2
+
3
+ # As of AER
4
+ MtgModernColors = [
5
+ [0, "b", 3],
6
+ [0, "g", 1],
7
+ [0, "r", 2],
8
+ [0, "u", 3],
9
+ [0, "w", 2],
10
+ [0, "x", 29],
11
+ [1, "b", 180],
12
+ [1, "g", 198],
13
+ [1, "m", 35],
14
+ [1, "r", 203],
15
+ [1, "u", 161],
16
+ [1, "w", 215],
17
+ [1, "x", 148],
18
+ [2, "b", 293],
19
+ [2, "g", 324],
20
+ [2, "m", 237],
21
+ [2, "r", 303],
22
+ [2, "u", 332],
23
+ [2, "w", 392],
24
+ [2, "x", 266],
25
+ [3, "b", 364],
26
+ [3, "g", 344],
27
+ [3, "m", 287],
28
+ [3, "r", 369],
29
+ [3, "u", 344],
30
+ [3, "w", 347],
31
+ [3, "x", 328],
32
+ [4, "b", 300],
33
+ [4, "g", 293],
34
+ [4, "m", 225],
35
+ [4, "r", 316],
36
+ [4, "u", 311],
37
+ [4, "w", 299],
38
+ [4, "x", 201],
39
+ [5, "b", 225],
40
+ [5, "g", 214],
41
+ [5, "m", 205],
42
+ [5, "r", 202],
43
+ [5, "u", 197],
44
+ [5, "w", 182],
45
+ [5, "x", 109],
46
+ [6, "b", 119],
47
+ [6, "g", 120],
48
+ [6, "m", 116],
49
+ [6, "r", 125],
50
+ [6, "u", 115],
51
+ [6, "w", 87],
52
+ [6, "x", 77],
53
+ [7, "b", 48],
54
+ [7, "g", 58],
55
+ [7, "m", 47],
56
+ [7, "r", 36],
57
+ [7, "u", 42],
58
+ [7, "w", 45],
59
+ [7, "x", 44],
60
+ [8, "b", 12],
61
+ [8, "g", 23],
62
+ [8, "m", 20],
63
+ [8, "r", 16],
64
+ [8, "u", 11],
65
+ [8, "w", 10],
66
+ [8, "x", 18],
67
+ [9, "b", 8],
68
+ [9, "g", 5],
69
+ [9, "r", 6],
70
+ [9, "u", 8],
71
+ [9, "w", 5],
72
+ [9, "x", 9],
73
+ [10, "b", 2],
74
+ [10, "g", 2],
75
+ [10, "m", 2],
76
+ [10, "r", 2],
77
+ [10, "u", 8],
78
+ [10, "w", 2],
79
+ [10, "x", 6],
80
+ [11, "g", 1],
81
+ [11, "u", 1],
82
+ [11, "x", 6],
83
+ [12, "m", 1],
84
+ [12, "u", 1],
85
+ [12, "x", 2],
86
+ [13, "x", 1],
87
+ [14, "u", 1],
88
+ [15, "m", 1],
89
+ [15, "x", 1],
90
+ ].map do |cmc, color, count|
91
+ OpenStruct.new(
92
+ cmc: cmc,
93
+ color: color,
94
+ count: count,
95
+ )
96
+ end
@@ -0,0 +1,116 @@
1
+ require "ostruct"
2
+
3
+ # As of AER
4
+ # get rid of all *-cards
5
+ MtgModernCreatures = [
6
+ [-1, -1, 1],
7
+ [-1, 3, 1],
8
+ ["*", "*", 70],
9
+ ["*", 1, 2],
10
+ ["*", "1+*", 2],
11
+ ["*", 3, 3],
12
+ ["*", 4, 1],
13
+ ["*", 5, 1],
14
+ [0, "*", 1],
15
+ [0, 0, 86],
16
+ [0, 1, 47],
17
+ [0, 2, 32],
18
+ [0, 3, 42],
19
+ [0, 4, 41],
20
+ [0, 5, 18],
21
+ [0, 6, 9],
22
+ [0, 7, 2],
23
+ [0, 8, 2],
24
+ [0, 13, 2],
25
+ [1, 1, 757],
26
+ [1, 2, 178],
27
+ [1, 3, 147],
28
+ [1, 4, 70],
29
+ [1, 5, 23],
30
+ [1, 6, 4],
31
+ [1, 7, 2],
32
+ [1, 8, 1],
33
+ ["1+*", "1+*", 1],
34
+ [2, "*", 1],
35
+ [2, 0, 1],
36
+ [2, 1, 423],
37
+ [2, 2, 956],
38
+ [2, 3, 271],
39
+ [2, 4, 111],
40
+ [2, 5, 35],
41
+ [2, 6, 5],
42
+ [2, 7, 3],
43
+ [2, 8, 2],
44
+ [2, 10, 1],
45
+ [3, 1, 111],
46
+ [3, 2, 219],
47
+ [3, 3, 532],
48
+ [3, 4, 121],
49
+ [3, 5, 49],
50
+ [3, 6, 17],
51
+ [3, 7, 4],
52
+ [3, 8, 1],
53
+ [4, 1, 31],
54
+ [4, 2, 53],
55
+ [4, 3, 106],
56
+ [4, 4, 338],
57
+ [4, 5, 75],
58
+ [4, 6, 27],
59
+ [4, 7, 7],
60
+ [4, 8, 1],
61
+ [4, 9, 2],
62
+ [5, 1, 11],
63
+ [5, 2, 16],
64
+ [5, 3, 40],
65
+ [5, 4, 77],
66
+ [5, 5, 203],
67
+ [5, 6, 34],
68
+ [5, 7, 17],
69
+ [5, 8, 3],
70
+ [5, 9, 1],
71
+ [6, 1, 8],
72
+ [6, 2, 4],
73
+ [6, 3, 8],
74
+ [6, 4, 32],
75
+ [6, 5, 31],
76
+ [6, 6, 125],
77
+ [6, 7, 8],
78
+ [6, 8, 2],
79
+ [6, 9, 1],
80
+ [7, 2, 3],
81
+ [7, 3, 1],
82
+ [7, 4, 5],
83
+ [7, 5, 7],
84
+ [7, 6, 13],
85
+ [7, 7, 47],
86
+ [7, 8, 2],
87
+ [7, 10, 1],
88
+ [7, 11, 2],
89
+ [8, 0, 1],
90
+ [8, 4, 1],
91
+ [8, 5, 3],
92
+ [8, 7, 1],
93
+ [8, 8, 30],
94
+ [8, 9, 1],
95
+ [9, 5, 1],
96
+ [9, 7, 2],
97
+ [9, 8, 1],
98
+ [9, 9, 11],
99
+ [9, 10, 1],
100
+ [9, 14, 1],
101
+ [10, 2, 1],
102
+ [10, 8, 1],
103
+ [10, 9, 1],
104
+ [10, 10, 13],
105
+ [11, 9, 1],
106
+ [11, 11, 4],
107
+ [12, 12, 3],
108
+ [13, 13, 5],
109
+ [15, 15, 2],
110
+ ].map do |p,t,c|
111
+ OpenStruct.new(
112
+ power: p,
113
+ toughness: t,
114
+ count: c,
115
+ )
116
+ end.select{|cg| cg.power.is_a?(Integer) and cg.toughness.is_a?(Integer) }
@@ -0,0 +1,100 @@
1
+ require "ostruct"
2
+
3
+ Olympics2016Medals = [
4
+ ["United States", "USA", 46, 37, 38],
5
+ ["Great Britain", "GBR", 27, 23, 17],
6
+ ["China", "CHN", 26, 18, 26],
7
+ ["Russia", "RUS", 19, 17, 19],
8
+ ["Germany", "GER", 17, 10, 15],
9
+ ["Japan", "JPN", 12, 8, 21],
10
+ ["France", "FRA", 10, 18, 14],
11
+ ["South Korea", "KOR", 9, 3, 9],
12
+ ["Italy", "ITA", 8, 12, 8],
13
+ ["Australia", "AUS", 8, 11, 10],
14
+ ["Netherlands", "NED", 8, 7, 4],
15
+ ["Hungary", "HUN", 8, 3, 4],
16
+ ["Brazil", "BRA", 7, 6, 6],
17
+ ["Spain", "ESP", 7, 4, 6],
18
+ ["Kenya", "KEN", 6, 6, 1],
19
+ ["Jamaica", "JAM", 6, 3, 2],
20
+ ["Croatia", "CRO", 5, 3, 2],
21
+ ["Cuba", "CUB", 5, 2, 4],
22
+ ["New Zealand", "NZL", 4, 9, 5],
23
+ ["Canada", "CAN", 4, 3, 15],
24
+ ["Uzbekistan", "UZB", 4, 2, 7],
25
+ ["Kazakhstan", "KAZ", 3, 5, 9],
26
+ ["Colombia", "COL", 3, 2, 3],
27
+ ["Switzerland", "SUI", 3, 2, 2],
28
+ ["Iran", "IRI", 3, 1, 4],
29
+ ["Greece", "GRE", 3, 1, 2],
30
+ ["Argentina", "ARG", 3, 1, 0],
31
+ ["Denmark", "DEN", 2, 6, 7],
32
+ ["Sweden", "SWE", 2, 6, 3],
33
+ ["South Africa", "RSA", 2, 6, 2],
34
+ ["Ukraine", "UKR", 2, 5, 4],
35
+ ["Serbia", "SRB", 2, 4, 2],
36
+ ["Poland", "POL", 2, 3, 6],
37
+ ["North Korea", "PRK", 2, 3, 2],
38
+ ["Belgium", "BEL", 2, 2, 2],
39
+ ["Thailand", "THA", 2, 2, 2],
40
+ ["Slovakia", "SVK", 2, 2, 0],
41
+ ["Georgia", "GEO", 2, 1, 4],
42
+ ["Azerbaijan", "AZE", 1, 7, 10],
43
+ ["Belarus", "BLR", 1, 4, 4],
44
+ ["Turkey", "TUR", 1, 3, 4],
45
+ ["Armenia", "ARM", 1, 3, 0],
46
+ ["Czech Republic", "CZE", 1, 2, 7],
47
+ ["Ethiopia", "ETH", 1, 2, 5],
48
+ ["Slovenia", "SLO", 1, 2, 1],
49
+ ["Indonesia", "INA", 1, 2, 0],
50
+ ["Romania", "ROU", 1, 1, 2],
51
+ ["Bahrain", "BRN", 1, 1, 0],
52
+ ["Vietnam", "VIE", 1, 1, 0],
53
+ ["Chinese Taipei", "TPE", 1, 0, 2],
54
+ ["Bahamas", "BAH", 1, 0, 1],
55
+ ["Côte d'Ivoire", "CIV", 1, 0, 1],
56
+ ["Independent", "IOA", 1, 0, 1],
57
+ ["Fiji", "FIJ", 1, 0, 0],
58
+ ["Jordan", "JOR", 1, 0, 0],
59
+ ["Kosovo", "KOS", 1, 0, 0],
60
+ ["Puerto Rico", "PUR", 1, 0, 0],
61
+ ["Singapore", "SIN", 1, 0, 0],
62
+ ["Tajikistan", "TJK", 1, 0, 0],
63
+ ["Malaysia", "MAS", 0, 4, 1],
64
+ ["Mexico", "MEX", 0, 3, 2],
65
+ ["Algeria", "ALG", 0, 2, 0],
66
+ ["Ireland", "IRL", 0, 2, 0],
67
+ ["Lithuania", "LTU", 0, 1, 3],
68
+ ["Bulgaria", "BUL", 0, 1, 2],
69
+ ["Venezuela", "VEN", 0, 1, 2],
70
+ ["India", "IND", 0, 1, 1],
71
+ ["Mongolia", "MGL", 0, 1, 1],
72
+ ["Burundi", "BDI", 0, 1, 0],
73
+ ["Grenada", "GRN", 0, 1, 0],
74
+ ["Niger", "NIG", 0, 1, 0],
75
+ ["Philippines", "PHI", 0, 1, 0],
76
+ ["Qatar", "QAT", 0, 1, 0],
77
+ ["Norway", "NOR", 0, 0, 4],
78
+ ["Egypt", "EGY", 0, 0, 3],
79
+ ["Tunisia", "TUN", 0, 0, 3],
80
+ ["Israel", "ISR", 0, 0, 2],
81
+ ["Austria", "AUT", 0, 0, 1],
82
+ ["Dominican Republic", "DOM", 0, 0, 1],
83
+ ["Estonia", "EST", 0, 0, 1],
84
+ ["Finland", "FIN", 0, 0, 1],
85
+ ["Morocco", "MAR", 0, 0, 1],
86
+ ["Moldova", "MDA", 0, 0, 1],
87
+ ["Nigeria", "NGR", 0, 0, 1],
88
+ ["Portugal", "POR", 0, 0, 1],
89
+ ["Trinidad and Tobago", "TTO", 0, 0, 1],
90
+ ["United Arab Emirates", "UAE", 0, 0, 1],
91
+ ].map{|n,a,g,s,b|
92
+ OpenStruct.new(
93
+ name: n,
94
+ acronym: a,
95
+ gold: g,
96
+ silver: s,
97
+ bronze: b,
98
+ total: g+s+b,
99
+ )
100
+ }
@@ -0,0 +1,60 @@
1
+ require "ostruct"
2
+ require "time"
3
+
4
+ ParadoxGames = [
5
+ ["Crusader Kings", 1, "", "2004-08-27"],
6
+ ["Crusader Kings", 1, "Deus Vult", "2007-10-04"],
7
+ ["Crusader Kings", 2, "", "2012-02-14"],
8
+ ["Crusader Kings", 2, "Sword of Islam", "2012-06-26"],
9
+ ["Crusader Kings", 2, "Legacy of Rome", "2012-10-16"],
10
+ ["Crusader Kings", 2, "Sunset Invasion", "2012-11-15"],
11
+ ["Crusader Kings", 2, "The Republic", "2013-01-12"],
12
+ ["Crusader Kings", 2, "The Old Gods", "2013-05-28"],
13
+ ["Crusader Kings", 2, "Sons of Abraham", "2013-11-18"],
14
+ ["Crusader Kings", 2, "Charlemagne", "2014-10-14"],
15
+ ["Crusader Kings", 2, "Rajas of India", "2014-03-25"],
16
+ ["Crusader Kings", 2, "Way of Life", "2014-12-16"],
17
+ ["Crusader Kings", 2, "Horse Lords", "2015-07-14"],
18
+ ["Crusader Kings", 2, "Conclave", "2016-02-02"],
19
+ ["Crusader Kings", 2, "The Reaper's Due", "2016-08-25"],
20
+ ["Europa Universalis", 1, "", "2000-02-20"],
21
+ ["Europa Universalis", 2, "", "2001-12-11"],
22
+ ["Europa Universalis", 2, "Asia Chapters", "2004-03-25"],
23
+ ["Europa Universalis", 3, "", "2007-01-23"],
24
+ ["Europa Universalis", 3, "Napoleon's Ambition", "2007-08-22"],
25
+ ["Europa Universalis", 3, "In Nomine", "2008-05-28"],
26
+ ["Europa Universalis", 3, "Heir to the Throne", "2009-12-15"],
27
+ ["Europa Universalis", 3, "Divine Wind", "2010-12-14"],
28
+ ["Europa Universalis", 4, "", "2013-08-13"],
29
+ ["Europa Universalis", 4, "Conquest of Paradise", "2014-01-14"],
30
+ ["Europa Universalis", 4, "Wealth of Nations", "2014-05-29"],
31
+ ["Europa Universalis", 4, "Res Publica", "2014-07-16"],
32
+ ["Europa Universalis", 4, "Art of War", "2014-10-30"],
33
+ ["Europa Universalis", 4, "El Dorado", "2015-02-26"],
34
+ ["Europa Universalis", 4, "Common Sense", "2015-06-09"],
35
+ ["Europa Universalis", 4, "The Cossacks", "2015-12-01"],
36
+ ["Europa Universalis", 4, "Mare Nostrum", "2016-04-05"],
37
+ ["Europa Universalis", 4, "Rights of Man", "2016-10-11"],
38
+ ["Hearts of Iron", 1, "", "2002-11-24"],
39
+ ["Hearts of Iron", 2, "", "2005-01-04"],
40
+ ["Hearts of Iron", 2, "Armageddon", "2007-03-29"],
41
+ ["Hearts of Iron", 2, "Doomsday", "2006-04-04"],
42
+ ["Hearts of Iron", 2, "Iron Cross", "2010-10-07"],
43
+ ["Hearts of Iron", 3, "", "2009-08-07"],
44
+ ["Hearts of Iron", 3, "Semper Fi", "2010-06-06"],
45
+ ["Hearts of Iron", 3, "For the Motherland", "2011-06-29"],
46
+ ["Hearts of Iron", 3, "Their Finest Hour", "2012-09-29"],
47
+ ["Hearts of Iron", 4, "", "2016-06-06"],
48
+ ["Victoria", 1, "", "2003-08-13"],
49
+ ["Victoria", 1, "Revolutions", "2006-08-17"],
50
+ ["Victoria", 2, "", "2010-08-13"],
51
+ ["Victoria", 2, "A House Divided", "2012-02-02"],
52
+ ["Victoria", 2, "Heart of Darkness", "2013-04-16"],
53
+ ].map do |s,n,d,t|
54
+ OpenStruct.new(
55
+ series: s,
56
+ number: n,
57
+ dlc: d,
58
+ time: Time.parse(t),
59
+ )
60
+ end
@@ -0,0 +1,28 @@
1
+ require "ostruct"
2
+ require "time"
3
+
4
+ PolishPMs = [
5
+ ["Tadeusz Mazowiecki", "UD", "1989-08-24", "1991-01-04"],
6
+ ["Jan Krzysztof Bielecki", "KLD", "1991-01-04", "1991-12-06"],
7
+ ["Jan Olszewski", "PC", "1991-12-06", "1992-06-05"],
8
+ ["Waldemar Pawlak", "PSL", "1992-06-05", "1992-07-11"],
9
+ ["Hanna Suchocka", "UD", "1992-07-11", "1993-10-26"],
10
+ ["Waldemar Pawlak", "PSL", "1993-10-26", "1995-03-07"],
11
+ ["Józef Oleksy", "SLD", "1995-03-07", "1996-02-07"],
12
+ ["Włodzimierz Cimoszewicz", "SLD", "1996-02-07", "1997-10-31"],
13
+ ["Jerzy Buzek", "AWS", "1997-10-31", "2001-10-19"],
14
+ ["Leszek Miller", "SLD", "2001-10-19", "2004-05-02"],
15
+ ["Marek Belka", "SLD", "2004-05-02", "2005-10-31"],
16
+ ["Kazimierz Marcinkiewicz", "PiS", "2005-10-31", "2006-07-14"],
17
+ ["Jarosław Kaczyński", "PiS", "2006-07-14", "2007-11-16"],
18
+ ["Donald Tusk", "PO", "2007-11-16", "2014-09-22"],
19
+ ["Ewa Kopacz", "PO", "2014-09-22", "2015-11-16"],
20
+ ["Beata Szydło", "PiS", "2015-11-16", "2017-01-06"],
21
+ ].map{|n,p,s,e|
22
+ OpenStruct.new(
23
+ name: n,
24
+ party: p,
25
+ start: Time.parse(s),
26
+ end: Time.parse(e),
27
+ )
28
+ }