quizzy 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +82 -0
  3. metadata +99 -0
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Jacob Atzen
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,82 @@
1
+ = Quizzy
2
+
3
+ Quizzy is a declarative survey engine that given a survey definition will
4
+ render pages from the survey and perform validation and routing on submits
5
+ of survey pages.
6
+
7
+ A very simple survey definition might look like:
8
+
9
+ {
10
+ :pages =>
11
+ [
12
+ { :questions => [{ :template => "radio", :name => "test" }] },
13
+ { :questions => [{ :template => "checkbox", :name => "cbox" }] }
14
+ ],
15
+ :question_templates => {
16
+ :radio => %q{<input type="radio" name="{{name}}" value="1">},
17
+ :checkbox => %q{<input type="checkbox" name="{{name}}">}
18
+ }
19
+ }
20
+
21
+ This definition has two pages, one with a radio button and one with a
22
+ checkbox. As shown a question hash is something like:
23
+
24
+ { :template => "radio", :name => "test" }
25
+
26
+ The questions are rendered with the question_template named
27
+ in the template key in the question hash. Any other attributes are passed
28
+ to the question template on rendering (like name in the above example).
29
+
30
+ Please see doc/survey_definition.rdoc for further information.
31
+
32
+ == Validations
33
+
34
+ Validations are added to pages and will be run when the page is submitted.
35
+ A page with a validation could look like:
36
+
37
+ { :questions => { :template => "radio", :name => "test" },
38
+ :validations =>
39
+ [{ :eval => "response[:test] == '1'",
40
+ :message => "Please pick a radio" }]
41
+ }
42
+
43
+ Given a response it is possible to ask if a page is valid for the response.
44
+ In the above example the page is only valid for responses where test is set
45
+ to 1.
46
+
47
+ == Branching
48
+
49
+ By default users will be routed through the survey in the order of the pages.
50
+ It is possible to setup routing rules and ask the engine to route the
51
+ respondent other ways through. This is usually used for skipping pages that
52
+ are not relevant for a given respondent.
53
+
54
+ A survey definition with branching rules could look like:
55
+
56
+ { :pages => [
57
+ { :questions => [{:template => :radio, :name => "test" }],
58
+ :postbranches => [{:eval => "response[:test] == '1'",
59
+ :redirect_to => :page3 }]
60
+ },
61
+ { :questions => [{:template => :radio, :name => "test2"}]},
62
+ { :id => :page3,
63
+ :questions => [{:template => :radio, :name => "test3"}]}
64
+ ]}
65
+
66
+ In this case the respondent will go directly to page 3 if the response
67
+ contains test = 1, otherwise the respondent will go to page 2. Notice the
68
+ match between the redirect_to key in the postbranch and the id on page 3.
69
+
70
+ == Note on Patches/Pull Requests
71
+
72
+ * Fork the project.
73
+ * Make your feature addition or bug fix.
74
+ * Add tests for it. This is important so I don't break it in a
75
+ future version unintentionally.
76
+ * Commit, do not mess with rakefile, version, or history.
77
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
78
+ * Send me a pull request. Bonus points for topic branches.
79
+
80
+ == Copyright
81
+
82
+ Copyright (c) 2010 Jacob Atzen. See LICENSE for details.
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: quizzy
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.3.3
6
+ platform: ruby
7
+ authors:
8
+ - Jacob Atzen
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-11-02 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: liquid
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.0.0
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: activesupport
28
+ prerelease: false
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 2.3.5
35
+ type: :runtime
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: config_newton
39
+ prerelease: false
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 0.1.1
46
+ type: :runtime
47
+ version_requirements: *id003
48
+ - !ruby/object:Gem::Dependency
49
+ name: rspec
50
+ prerelease: false
51
+ requirement: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 1.2.9
57
+ type: :development
58
+ version_requirements: *id004
59
+ description: Survey engine supporting complex surveys
60
+ email: jacob@incremental.dk
61
+ executables: []
62
+
63
+ extensions: []
64
+
65
+ extra_rdoc_files:
66
+ - LICENSE
67
+ - README.rdoc
68
+ files:
69
+ - LICENSE
70
+ - README.rdoc
71
+ homepage: http://github.com/jacobat/quizzy
72
+ licenses: []
73
+
74
+ post_install_message:
75
+ rdoc_options: []
76
+
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: "0"
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: "0"
91
+ requirements: []
92
+
93
+ rubyforge_project:
94
+ rubygems_version: 1.8.10
95
+ signing_key:
96
+ specification_version: 3
97
+ summary: The Quizzy survey engine
98
+ test_files: []
99
+