active_record_survey 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d54c3e737a268c6e9aa3f60f02a62433131007f3
4
- data.tar.gz: 56c1e7fa286ef30e2735fc1f6f118cae6facc6f3
3
+ metadata.gz: 135e7023d35c5af25cb9b0d68a8809dbfd5591ac
4
+ data.tar.gz: c0cef2a7b97e07073c762c9e83a9fde9c002fdad
5
5
  SHA512:
6
- metadata.gz: 4618ddd55a8dda8bc1b6589ba8241cb9afc73bfdf502439990fb449441c4334d1a3b3d1306843e8b00f9c040b331787d265dc594c616dc32e953847e0745b05d
7
- data.tar.gz: 1ce77748739de54e4189e94a40951bf22e877d69bd636401ca9097fee94d6211e56c7bf7b8627b7740a356244441acdd80545031984d14446f7efb746a9c915c
6
+ metadata.gz: 65791020c8e6d72375cdb4e9f492b0fdbd32116169311eb91e794a681fbd626bfb5d0b3c160825a3be0689d32f1ed25ac96e0fad7f5655a8bcd4c89835cada30
7
+ data.tar.gz: 44836e1c6182ad21517f00d4f2dc0fa6881df7b2fa2804439f30f07730e0284beadeacd8e6aace4249fce3aa316040a695ce2a6e71c0d2f98ced92511de99781
data/README.md CHANGED
@@ -5,6 +5,10 @@
5
5
 
6
6
  An attempt at a more versatile data structure for making and taking surveys.
7
7
 
8
+ This gem tries to be as unopinionated as possible on the peripheral details on how you implement a survey.
9
+
10
+ The goal is to give a simple interface for creating surveys and validating the answers given to them.
11
+
8
12
  ## Installation
9
13
 
10
14
  Add this line to your application's Gemfile:
@@ -23,7 +27,48 @@ Or install it yourself as:
23
27
 
24
28
  ## Usage
25
29
 
26
- TODO: Write usage instructions here
30
+ See the spec file for more detailed usage.
31
+
32
+ **Build a basic survey**
33
+ ```ruby
34
+
35
+ q1 = ActiveRecordSurvey::Node::Question.new() # Q1
36
+ q1_a1 = ActiveRecordSurvey::Node::Answer.new() # Q1 A1
37
+ q1_a2 = ActiveRecordSurvey::Node::Answer.new() # Q1 A2
38
+ q1_a3 = ActiveRecordSurvey::Node::Answer.new() # Q1 A3
39
+
40
+ q2 = ActiveRecordSurvey::Node::Question.new() # Q2
41
+ q2_a1 = ActiveRecordSurvey::Node::Answer.new() # Q2 A1
42
+ q2_a2 = ActiveRecordSurvey::Node::Answer.new() # Q2 A2
43
+
44
+ q3 = ActiveRecordSurvey::Node::Question.new() # Q3
45
+ q3_a1 = ActiveRecordSurvey::Node::Answer.new() # Q3 A1
46
+ q3_a2 = ActiveRecordSurvey::Node::Answer.new() # Q3 A2
47
+
48
+ q4 = ActiveRecordSurvey::Node::Question.new() # Q4
49
+ q4_a1 = ActiveRecordSurvey::Node::Answer.new() # Q4 A1
50
+ q4_a2 = ActiveRecordSurvey::Node::Answer.new() # Q4 A2
51
+
52
+ q1_nodes = survey.build_question(q1, [q1_a1, q1_a2, q1_a3])
53
+ q2_nodes = survey.build_question(q2, [q2_a1, q2_a2], q1_nodes[1])
54
+ q4_nodes = survey.build_question(q4, [q4_a1, q4_a2], q2_nodes[1])
55
+
56
+ q3_nodes = survey.build_question(q3, [q3_a1, q3_a2], q2_nodes[2])
57
+ q4_nodes = survey.build_question(q4, [q4_a1, q4_a2], q3_nodes[1])
58
+ q4_nodes = survey.build_question(q4, [q4_a1, q4_a2], q3_nodes[2])
59
+
60
+ q3_nodes = survey.build_question(q3, [q3_a1, q3_a2], q1_nodes[2])
61
+ q4_nodes = survey.build_question(q4, [q4_a1, q4_a2], q3_nodes[1])
62
+ q4_nodes = survey.build_question(q4, [q4_a1, q4_a2], q3_nodes[2])
63
+
64
+ q4_nodes = survey.build_question(q4, [q4_a1, q4_a2], q1_nodes[3])
65
+
66
+ survey.save
67
+ ```
68
+
69
+ The will build a survey with the following node structure.
70
+
71
+ ![alt tag](https://raw.github.com/butchmarshall/active_record_survey/bin/Example_1.png)
27
72
 
28
73
  ## Development
29
74
 
data/bin/Example_1.png ADDED
Binary file
data/bin/Example_1.svg ADDED
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="533px" height="883px" version="1.1" style="background-color: rgb(255, 255, 255);"><defs/><g transform="translate(0.5,0.5)"><ellipse cx="301" cy="41" rx="60" ry="40" fill="#ffffff" stroke="#000000" pointer-events="none"/><g transform="translate(286,35)"><switch><foreignObject pointer-events="all" width="29" height="16" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 29px; white-space: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Q1</div></div></foreignObject><text x="15" y="14" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><path d="M 131 121 L 171 161 L 131 201 L 91 161 Z" fill="#ffffff" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><g transform="translate(117,155)"><switch><foreignObject pointer-events="all" width="27" height="16" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 27px; white-space: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">A1</div></div></foreignObject><text x="14" y="14" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><path d="M 301 121 L 341 161 L 301 201 L 261 161 Z" fill="#ffffff" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><g transform="translate(287,155)"><switch><foreignObject pointer-events="all" width="27" height="16" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 27px; white-space: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">A2</div></div></foreignObject><text x="14" y="14" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><path d="M 491 121 L 531 161 L 491 201 L 451 161 Z" fill="#ffffff" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><g transform="translate(477,155)"><switch><foreignObject pointer-events="all" width="27" height="16" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 27px; white-space: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">A3</div></div></foreignObject><text x="14" y="14" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><ellipse cx="91" cy="291" rx="60" ry="40" fill="#ffffff" stroke="#000000" pointer-events="none"/><g transform="translate(76,285)"><switch><foreignObject pointer-events="all" width="29" height="16" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 29px; white-space: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Q2</div></div></foreignObject><text x="15" y="14" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><path d="M 41 371 L 81 411 L 41 451 L 1 411 Z" fill="#ffffff" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><g transform="translate(27,405)"><switch><foreignObject pointer-events="all" width="27" height="16" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 27px; white-space: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">A1</div></div></foreignObject><text x="14" y="14" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><path d="M 141 371 L 181 411 L 141 451 L 101 411 Z" fill="#ffffff" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><g transform="translate(127,405)"><switch><foreignObject pointer-events="all" width="27" height="16" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 27px; white-space: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">A2</div></div></foreignObject><text x="14" y="14" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><ellipse cx="301" cy="411" rx="60" ry="40" fill="#ffffff" stroke="#000000" pointer-events="none"/><g transform="translate(286,405)"><switch><foreignObject pointer-events="all" width="29" height="16" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 29px; white-space: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Q3</div></div></foreignObject><text x="15" y="14" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><path d="M 251 491 L 291 531 L 251 571 L 211 531 Z" fill="#ffffff" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><g transform="translate(237,525)"><switch><foreignObject pointer-events="all" width="27" height="16" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 27px; white-space: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">A1</div></div></foreignObject><text x="14" y="14" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><path d="M 351 491 L 391 531 L 351 571 L 311 531 Z" fill="#ffffff" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><g transform="translate(337,525)"><switch><foreignObject pointer-events="all" width="27" height="16" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 27px; white-space: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">A2</div></div></foreignObject><text x="14" y="14" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><ellipse cx="301" cy="721" rx="60" ry="40" fill="#ffffff" stroke="#000000" pointer-events="none"/><g transform="translate(286,715)"><switch><foreignObject pointer-events="all" width="29" height="16" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 29px; white-space: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Q4</div></div></foreignObject><text x="15" y="14" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><path d="M 251 801 L 291 841 L 251 881 L 211 841 Z" fill="#ffffff" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><g transform="translate(237,835)"><switch><foreignObject pointer-events="all" width="27" height="16" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 27px; white-space: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">A1</div></div></foreignObject><text x="14" y="14" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><path d="M 351 801 L 391 841 L 351 881 L 311 841 Z" fill="#ffffff" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><g transform="translate(337,835)"><switch><foreignObject pointer-events="all" width="27" height="16" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 27px; white-space: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">A2</div></div></foreignObject><text x="14" y="14" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><path d="M 259 69 L 136.9 118.6" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 132.04 120.58 L 137.2 114.7 L 136.9 118.6 L 139.84 121.19 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 343 69 L 484.99 118.89" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 489.95 120.63 L 482.18 121.61 L 484.99 118.89 L 484.5 115.01 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 301 81 L 301 114.63" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 301 119.88 L 297.5 112.88 L 301 114.63 L 304.5 112.88 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 131 201 L 94.98 246.03" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 91.7 250.13 L 93.34 242.47 L 94.98 246.03 L 98.8 246.85 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 49 319 L 41.97 364.71" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 41.17 369.9 L 38.78 362.44 L 41.97 364.71 L 45.69 363.51 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 133 319 L 140.19 374.68" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 140.86 379.89 L 136.49 373.4 L 140.19 374.68 L 143.43 372.5 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 301 201 L 301 364.63" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 301 369.88 L 297.5 362.88 L 301 364.63 L 304.5 362.88 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 181 411 L 234.63 411" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 239.88 411 L 232.88 414.5 L 234.63 411 L 232.88 407.5 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 41 451 L 237.21 715.88" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 240.33 720.1 L 233.36 716.56 L 237.21 715.88 L 238.98 712.39 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 491 201 L 362.54 714.82" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 361.27 719.92 L 359.57 712.28 L 362.54 714.82 L 366.36 713.97 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 324.08 447.92 L 347.62 485.6" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 350.41 490.05 L 343.73 485.97 L 347.62 485.6 L 349.67 482.26 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 277.92 447.92 L 254.38 485.6" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 251.59 490.05 L 252.33 482.26 L 254.38 485.6 L 258.27 485.97 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 351 571 L 343.42 686.65" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 343.07 691.88 L 340.04 684.67 L 343.42 686.65 L 347.02 685.13 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 251 571 L 258.58 686.65" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 258.93 691.88 L 254.98 685.13 L 258.58 686.65 L 261.96 684.67 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 343 749 L 350.03 794.71" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 350.83 799.9 L 346.31 793.51 L 350.03 794.71 L 353.22 792.44 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 259 749 L 251.97 794.71" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 251.17 799.9 L 248.78 792.44 L 251.97 794.71 L 255.69 793.51 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/></g></svg>
data/bin/Example_1.xml ADDED
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <mxfile userAgent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36" type="browser"><diagram>7VtNc5swEP01PiZjkL9yTNM0vXQmmRzaHgkohgm2PLIc2/31EWIXkIUzTgJI7uCL0QqE9u3TandlD8jNYnfHg1X8i0U0HfjDaDcg3we+743ISH5lkn0umU5lKxPMeRLBTaXgMflHQTgE6SaJ6Fq7UTCWimSlC0O2XNJQaLJnluqvWAVzHL4UPIZBakp/J5GIc+nMn5TynzSZx/gab3KV9zwF4cucs80S3jfwybP65N2LAMdSWpFbiRhnTA6TXS12NzTNUENActV/HOktJsnpEiby/gMA+GuQbkDPBxhjLfaounxEQiob37ZxIujjKgiznq20qpTFYpHKlicvYTDKBUUjmxNSIpjNHWULKvhe3gIPkAkYFzgxgua2xNwDnYZxBe8ZyAIw/bwYudReXgAA9WAQA4xrEwwes8XTRr6lAzAKpgMYHoJTQQMVbxoMWJtVMIAslsAgqJUFMMYmGEAWS2CMp/bAAL9W9RkmM7r0Gd5YB8O/6tBp4BJ1x2sUqqILxSl2wA0PZuuO28Ad0AoaM3OpmH7D6vZag0Z7S8X0HJaXCiE6HGNsd0AORNmdpTKyiYYZfD1ACOLIUpmiwbpYKnXhl1tLZVYTmbdGjpr4y62l0iUaxETDXCjL6JpztpWtMA3W6yTUIVgLzl7oDUsZVw+QofoUPZjiZvdKSPj+j2wML8fY/Js1s8YuEaoLrjN5CTGNjJz6AGA5abbhyk5lNioCPqdwl3ILphkqMGPwV4UZZZymgUhe9UnUYQ9vuGeJnF4ZSelGxrASB8inDs9Uk+yDYY6ktDhMrq4xjKJBofJpzIBiRGfMAOvjNVr/PcY0xgy1Cmwx46JIuMCoRXb6UXJceAcsKxxtC/yYuuM5GuOB2il7D3EiA8yMxP7ekXd9efeACLLKDZVw9Nw4seJnJiT/SVwBeWeVGblxemqcSA2zrGOHGpee3PdBcE95InWg2XBVzhxGI81x5khO0HOmljPm2dKZBRuQg2sUUPtnT4ETKWAWdTqigO40ML449A55z+fIgZVuZ9nhS5CaoEdxutICP8wql3V+NBWNojWq/HCqmnEO/LBV6Soa7fEDVHOWHmjlr7KjPXJ0XexqPL7A40GNAy7lJefgIs6+pFXHgvyktGfBySywVdbSN4oWtgk8YOzDiC+ww/zdQSfHIiYHjgSgn/cdNVWKnh0fYweO7FLZs5kSVl1F3O6x2eFRV0PsKKbXAjtcqXw2f9hexw6XDtPcY4dslj/Nz28v/9lAbt8A</diagram></mxfile>
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordSurvey
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
@@ -6,7 +6,6 @@ class AddActiveRecordSurvey < ActiveRecord::Migration
6
6
 
7
7
  create_table :active_record_survey_nodes do |t|
8
8
  t.string :type
9
- t.string :text
10
9
 
11
10
  t.timestamps null: false
12
11
  end
@@ -5,12 +5,12 @@ describe ActiveRecordSurvey::Node::Answer::Boolean, :boolean_spec => true do
5
5
  before(:all) do
6
6
  @survey = ActiveRecordSurvey::Survey.new
7
7
 
8
- @q1 = ActiveRecordSurvey::Node::Question.new(:text => "Please select two")
9
- @q1_a1 = ActiveRecordSurvey::Node::Answer::Boolean.new(:text => "Dog")
10
- @q1_a2 = ActiveRecordSurvey::Node::Answer::Boolean.new(:text => "Cat")
11
- @q1_a3 = ActiveRecordSurvey::Node::Answer::Boolean.new(:text => "Mouse")
12
- @q1_a4 = ActiveRecordSurvey::Node::Answer::Boolean.new(:text => "Tiger")
13
- @q1_a5 = ActiveRecordSurvey::Node::Answer::Boolean.new(:text => "Bear")
8
+ @q1 = ActiveRecordSurvey::Node::Question.new()
9
+ @q1_a1 = ActiveRecordSurvey::Node::Answer::Boolean.new()
10
+ @q1_a2 = ActiveRecordSurvey::Node::Answer::Boolean.new()
11
+ @q1_a3 = ActiveRecordSurvey::Node::Answer::Boolean.new()
12
+ @q1_a4 = ActiveRecordSurvey::Node::Answer::Boolean.new()
13
+ @q1_a5 = ActiveRecordSurvey::Node::Answer::Boolean.new()
14
14
 
15
15
  nodes = @survey.build_question(@q1, [@q1_a1])
16
16
  nodes = @survey.build_question(@q1_a2, [], nodes[1])
@@ -5,12 +5,12 @@ describe ActiveRecordSurvey::Node::Answer::Rank, :rank_spec => true do
5
5
  before(:all) do
6
6
  @survey = ActiveRecordSurvey::Survey.new
7
7
 
8
- @q1 = ActiveRecordSurvey::Node::Question.new(:text => "Order by preference")
9
- @q1_a1 = ActiveRecordSurvey::Node::Answer::Rank.new(:text => "Dogs")
10
- @q1_a2 = ActiveRecordSurvey::Node::Answer::Rank.new(:text => "Cats")
11
- @q1_a3 = ActiveRecordSurvey::Node::Answer::Rank.new(:text => "Mice")
12
- @q1_a4 = ActiveRecordSurvey::Node::Answer::Rank.new(:text => "Ferrets")
13
- @q1_a5 = ActiveRecordSurvey::Node::Answer::Rank.new(:text => "Rats")
8
+ @q1 = ActiveRecordSurvey::Node::Question.new()
9
+ @q1_a1 = ActiveRecordSurvey::Node::Answer::Rank.new()
10
+ @q1_a2 = ActiveRecordSurvey::Node::Answer::Rank.new()
11
+ @q1_a3 = ActiveRecordSurvey::Node::Answer::Rank.new()
12
+ @q1_a4 = ActiveRecordSurvey::Node::Answer::Rank.new()
13
+ @q1_a5 = ActiveRecordSurvey::Node::Answer::Rank.new()
14
14
 
15
15
  nodes = @survey.build_question(@q1, [@q1_a1])
16
16
  nodes = @survey.build_question(@q1_a2, [], nodes[1])
@@ -5,10 +5,10 @@ describe ActiveRecordSurvey::Node::Answer::Scale, :scale_spec => true do
5
5
  before(:all) do
6
6
  @survey = ActiveRecordSurvey::Survey.new
7
7
 
8
- @q1 = ActiveRecordSurvey::Node::Question.new(:text => "Please select one")
9
- @q1_a1 = ActiveRecordSurvey::Node::Answer::Scale.new(:text => "How much do you like dogs?")
10
- @q1_a2 = ActiveRecordSurvey::Node::Answer::Scale.new(:text => "How much do you like cats?")
11
- @q1_a3 = ActiveRecordSurvey::Node::Answer::Scale.new(:text => "How much do you like mice?")
8
+ @q1 = ActiveRecordSurvey::Node::Question.new()
9
+ @q1_a1 = ActiveRecordSurvey::Node::Answer::Scale.new()
10
+ @q1_a2 = ActiveRecordSurvey::Node::Answer::Scale.new()
11
+ @q1_a3 = ActiveRecordSurvey::Node::Answer::Scale.new()
12
12
 
13
13
  nodes = @survey.build_question(@q1, [@q1_a1])
14
14
  nodes = @survey.build_question(@q1_a2, [], nodes[1])
@@ -5,9 +5,9 @@ describe ActiveRecordSurvey::Node::Answer::Text, :text_spec => true do
5
5
  before(:all) do
6
6
  @survey = ActiveRecordSurvey::Survey.new
7
7
 
8
- @q1 = ActiveRecordSurvey::Node::Question.new(:text => "What... what do you think?")
9
- @q1_a1 = ActiveRecordSurvey::Node::Answer::Text.new(:text => "Text #1")
10
- @q1_a2 = ActiveRecordSurvey::Node::Answer::Text.new(:text => "Text #2")
8
+ @q1 = ActiveRecordSurvey::Node::Question.new()
9
+ @q1_a1 = ActiveRecordSurvey::Node::Answer::Text.new()
10
+ @q1_a2 = ActiveRecordSurvey::Node::Answer::Text.new()
11
11
 
12
12
  nodes = @survey.build_question(@q1, [@q1_a1])
13
13
  nodes = @survey.build_question(@q1_a2, [], nodes[1])
@@ -176,7 +176,7 @@ describe ActiveRecordSurvey::Node::Answer::Text, :text_spec => true do
176
176
  :node => @q1_a2,
177
177
  )
178
178
  instance.save
179
- puts instance.errors.inspect
179
+
180
180
  expect(instance.valid?).to be(true)
181
181
  end
182
182
  end
@@ -223,7 +223,7 @@ puts instance.errors.inspect
223
223
  :node => @q1_a2,
224
224
  )
225
225
  instance.save
226
- puts instance.errors.inspect
226
+
227
227
  expect(instance.valid?).to be(true)
228
228
  end
229
229
  end
@@ -5,22 +5,22 @@ describe ActiveRecordSurvey::Survey do
5
5
  before(:all) do
6
6
  @survey = ActiveRecordSurvey::Survey.new
7
7
 
8
- @q1 = ActiveRecordSurvey::Node::Question.new(:text => "Q1")
9
- @q1_a1 = ActiveRecordSurvey::Node::Answer.new(:text => "Q1 A1")
10
- @q1_a2 = ActiveRecordSurvey::Node::Answer.new(:text => "Q1 A2")
11
- @q1_a3 = ActiveRecordSurvey::Node::Answer.new(:text => "Q1 A3")
8
+ @q1 = ActiveRecordSurvey::Node::Question.new()
9
+ @q1_a1 = ActiveRecordSurvey::Node::Answer.new()
10
+ @q1_a2 = ActiveRecordSurvey::Node::Answer.new()
11
+ @q1_a3 = ActiveRecordSurvey::Node::Answer.new()
12
12
 
13
- @q2 = ActiveRecordSurvey::Node::Question.new(:text => "Q2")
14
- @q2_a1 = ActiveRecordSurvey::Node::Answer.new(:text => "Q2 A1")
15
- @q2_a2 = ActiveRecordSurvey::Node::Answer.new(:text => "Q2 A2")
13
+ @q2 = ActiveRecordSurvey::Node::Question.new()
14
+ @q2_a1 = ActiveRecordSurvey::Node::Answer.new()
15
+ @q2_a2 = ActiveRecordSurvey::Node::Answer.new()
16
16
 
17
- @q3 = ActiveRecordSurvey::Node::Question.new(:text => "Q3")
18
- @q3_a1 = ActiveRecordSurvey::Node::Answer.new(:text => "Q3 A1")
19
- @q3_a2 = ActiveRecordSurvey::Node::Answer.new(:text => "Q3 A2")
17
+ @q3 = ActiveRecordSurvey::Node::Question.new()
18
+ @q3_a1 = ActiveRecordSurvey::Node::Answer.new()
19
+ @q3_a2 = ActiveRecordSurvey::Node::Answer.new()
20
20
 
21
- @q4 = ActiveRecordSurvey::Node::Question.new(:text => "Q4")
22
- @q4_a1 = ActiveRecordSurvey::Node::Answer.new(:text => "Q4 A1")
23
- @q4_a2 = ActiveRecordSurvey::Node::Answer.new(:text => "Q4 A2")
21
+ @q4 = ActiveRecordSurvey::Node::Question.new()
22
+ @q4_a1 = ActiveRecordSurvey::Node::Answer.new()
23
+ @q4_a2 = ActiveRecordSurvey::Node::Answer.new()
24
24
 
25
25
  q1_nodes = @survey.build_question(@q1, [@q1_a1, @q1_a2, @q1_a3])
26
26
  q2_nodes = @survey.build_question(@q2, [@q2_a1, @q2_a2], q1_nodes[1])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_survey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Butch Marshall
@@ -104,6 +104,9 @@ description: A data structure for adding survey capabilities using activerecord
104
104
  email:
105
105
  - butch.a.marshall@gmail.com
106
106
  executables:
107
+ - Example_1.png
108
+ - Example_1.svg
109
+ - Example_1.xml
107
110
  - console
108
111
  - setup
109
112
  extensions: []
@@ -117,6 +120,9 @@ files:
117
120
  - README.md
118
121
  - Rakefile
119
122
  - active_record_survey.gemspec
123
+ - bin/Example_1.png
124
+ - bin/Example_1.svg
125
+ - bin/Example_1.xml
120
126
  - bin/console
121
127
  - bin/setup
122
128
  - lib/active_record_survey.rb