typo 5.2.98 → 5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/sidebar_controller.rb +15 -3
- data/app/helpers/sidebar_helper.rb +9 -4
- data/app/models/feedback.rb +10 -2
- data/app/models/page_cache.rb +5 -1
- data/app/views/admin/blacklist/_blacklist_patterns.html.erb +2 -0
- data/app/views/admin/categories/new.html.erb +1 -1
- data/app/views/admin/content/_form.html.erb +3 -3
- data/app/views/admin/content/_simple_editor.html.erb +2 -0
- data/app/views/admin/content/_visual_editor.html.erb +2 -0
- data/app/views/admin/pages/_form.html.erb +5 -5
- data/app/views/admin/pages/_simple_editor.html.erb +2 -0
- data/app/views/admin/pages/_visual_editor.html.erb +2 -0
- data/app/views/articles/_comment_box.html.erb +1 -1
- data/app/views/articles/_comment_failed.html.erb +1 -1
- data/app/views/articles/read.html.erb +1 -1
- data/config/environment.rb +3 -2
- data/lib/tasks/release.rake +3 -4
- data/lib/typo_version.rb +1 -1
- data/public/stylesheets/administration.css +37 -2
- data/public/stylesheets/administration_rtl.css +316 -437
- data/vendor/actionwebservice/CHANGELOG +320 -0
- data/vendor/actionwebservice/MIT-LICENSE +21 -0
- data/vendor/actionwebservice/README +381 -0
- data/vendor/actionwebservice/Rakefile +173 -0
- data/vendor/actionwebservice/TODO +32 -0
- data/vendor/actionwebservice/examples/googlesearch/README +143 -0
- data/vendor/actionwebservice/examples/googlesearch/autoloading/google_search_api.rb +50 -0
- data/vendor/actionwebservice/examples/googlesearch/autoloading/google_search_controller.rb +57 -0
- data/vendor/actionwebservice/examples/googlesearch/delegated/google_search_service.rb +108 -0
- data/vendor/actionwebservice/examples/googlesearch/delegated/search_controller.rb +7 -0
- data/vendor/actionwebservice/examples/googlesearch/direct/google_search_api.rb +50 -0
- data/vendor/actionwebservice/examples/googlesearch/direct/search_controller.rb +58 -0
- data/vendor/actionwebservice/examples/metaWeblog/README +17 -0
- data/vendor/actionwebservice/examples/metaWeblog/apis/blogger_api.rb +60 -0
- data/vendor/actionwebservice/examples/metaWeblog/apis/blogger_service.rb +34 -0
- data/vendor/actionwebservice/examples/metaWeblog/apis/meta_weblog_api.rb +67 -0
- data/vendor/actionwebservice/examples/metaWeblog/apis/meta_weblog_service.rb +48 -0
- data/vendor/actionwebservice/examples/metaWeblog/controllers/xmlrpc_controller.rb +16 -0
- data/vendor/actionwebservice/generators/web_service/USAGE +28 -0
- data/vendor/actionwebservice/generators/web_service/templates/api_definition.rb +5 -0
- data/vendor/actionwebservice/generators/web_service/templates/controller.rb +8 -0
- data/vendor/actionwebservice/generators/web_service/templates/functional_test.rb +19 -0
- data/vendor/actionwebservice/generators/web_service/web_service_generator.rb +29 -0
- data/vendor/actionwebservice/lib/action_web_service.rb +66 -0
- data/vendor/actionwebservice/lib/action_web_service/api.rb +297 -0
- data/vendor/actionwebservice/lib/action_web_service/base.rb +38 -0
- data/vendor/actionwebservice/lib/action_web_service/casting.rb +144 -0
- data/vendor/actionwebservice/lib/action_web_service/client.rb +3 -0
- data/vendor/actionwebservice/lib/action_web_service/client/base.rb +28 -0
- data/vendor/actionwebservice/lib/action_web_service/client/soap_client.rb +113 -0
- data/vendor/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb +58 -0
- data/vendor/actionwebservice/lib/action_web_service/container.rb +3 -0
- data/vendor/actionwebservice/lib/action_web_service/container/action_controller_container.rb +93 -0
- data/vendor/actionwebservice/lib/action_web_service/container/delegated_container.rb +86 -0
- data/vendor/actionwebservice/lib/action_web_service/container/direct_container.rb +69 -0
- data/vendor/actionwebservice/lib/action_web_service/dispatcher.rb +2 -0
- data/vendor/actionwebservice/lib/action_web_service/dispatcher/abstract.rb +207 -0
- data/vendor/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb +379 -0
- data/vendor/actionwebservice/lib/action_web_service/invocation.rb +202 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol.rb +4 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/abstract.rb +112 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/discovery.rb +37 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/soap_protocol.rb +176 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb +242 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb +122 -0
- data/vendor/actionwebservice/lib/action_web_service/scaffolding.rb +281 -0
- data/vendor/actionwebservice/lib/action_web_service/struct.rb +64 -0
- data/vendor/actionwebservice/lib/action_web_service/support/class_inheritable_options.rb +26 -0
- data/vendor/actionwebservice/lib/action_web_service/support/signature_types.rb +226 -0
- data/vendor/actionwebservice/lib/action_web_service/templates/scaffolds/layout.html.erb +65 -0
- data/vendor/actionwebservice/lib/action_web_service/templates/scaffolds/methods.html.erb +6 -0
- data/vendor/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.html.erb +29 -0
- data/vendor/actionwebservice/lib/action_web_service/templates/scaffolds/result.html.erb +30 -0
- data/vendor/actionwebservice/lib/action_web_service/test_invoke.rb +110 -0
- data/vendor/actionwebservice/lib/action_web_service/version.rb +9 -0
- data/vendor/actionwebservice/lib/actionwebservice.rb +1 -0
- data/vendor/actionwebservice/setup.rb +1379 -0
- data/vendor/actionwebservice/test/abstract_client.rb +183 -0
- data/vendor/actionwebservice/test/abstract_dispatcher.rb +547 -0
- data/vendor/actionwebservice/test/abstract_unit.rb +33 -0
- data/vendor/actionwebservice/test/api_test.rb +102 -0
- data/vendor/actionwebservice/test/apis/auto_load_api.rb +3 -0
- data/vendor/actionwebservice/test/apis/broken_auto_load_api.rb +2 -0
- data/vendor/actionwebservice/test/base_test.rb +42 -0
- data/vendor/actionwebservice/test/casting_test.rb +86 -0
- data/vendor/actionwebservice/test/client_soap_test.rb +155 -0
- data/vendor/actionwebservice/test/client_xmlrpc_test.rb +153 -0
- data/vendor/actionwebservice/test/container_test.rb +73 -0
- data/vendor/actionwebservice/test/dispatcher_action_controller_soap_test.rb +137 -0
- data/vendor/actionwebservice/test/dispatcher_action_controller_xmlrpc_test.rb +59 -0
- data/vendor/actionwebservice/test/fixtures/db_definitions/mysql.sql +8 -0
- data/vendor/actionwebservice/test/fixtures/users.yml +12 -0
- data/vendor/actionwebservice/test/gencov +3 -0
- data/vendor/actionwebservice/test/invocation_test.rb +185 -0
- data/vendor/actionwebservice/test/run +6 -0
- data/vendor/actionwebservice/test/scaffolded_controller_test.rb +146 -0
- data/vendor/actionwebservice/test/struct_test.rb +52 -0
- data/vendor/actionwebservice/test/test_invoke_test.rb +112 -0
- data/vendor/gems/calendar_date_select-1.15/.specification +56 -0
- data/vendor/gems/calendar_date_select-1.15/History.txt +237 -0
- data/vendor/gems/calendar_date_select-1.15/MIT-LICENSE +20 -0
- data/vendor/gems/calendar_date_select-1.15/Manifest.txt +42 -0
- data/vendor/gems/calendar_date_select-1.15/Rakefile +31 -0
- data/vendor/gems/calendar_date_select-1.15/Readme.txt +16 -0
- data/vendor/gems/calendar_date_select-1.15/init.rb +1 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/functional/cds_test.html +334 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/prototype.js +4184 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/test.css +40 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/unit/cds_helper_methods.html +46 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/unittest.js +564 -0
- data/vendor/gems/calendar_date_select-1.15/lib/calendar_date_select.rb +33 -0
- data/vendor/gems/calendar_date_select-1.15/lib/calendar_date_select/calendar_date_select.rb +116 -0
- data/vendor/gems/calendar_date_select-1.15/lib/calendar_date_select/form_helpers.rb +225 -0
- data/vendor/gems/calendar_date_select-1.15/lib/calendar_date_select/includes_helper.rb +29 -0
- data/vendor/gems/calendar_date_select-1.15/public/blank_iframe.html +2 -0
- data/vendor/gems/calendar_date_select-1.15/public/images/calendar_date_select/calendar.gif +0 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/calendar_date_select.js +443 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_american.js +34 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_db.js +27 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_euro_24hr.js +7 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_euro_24hr_ymd.js +7 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_finnish.js +32 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_hyphen_ampm.js +37 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_iso_date.js +46 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_italian.js +24 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/de.js +11 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/fi.js +10 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/fr.js +10 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/pl.js +10 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/pt.js +11 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/ru.js +10 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/blue.css +130 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/default.css +135 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/plain.css +128 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/red.css +135 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/silver.css +133 -0
- data/vendor/gems/calendar_date_select-1.15/spec/calendar_date_select/calendar_date_select_spec.rb +14 -0
- data/vendor/gems/calendar_date_select-1.15/spec/calendar_date_select/form_helpers_spec.rb +166 -0
- data/vendor/gems/calendar_date_select-1.15/spec/spec_helper.rb +26 -0
- data/vendor/gems/coderay-0.8.260/.specification +2 -1
- data/vendor/gems/htmlentities-4.0.0/.specification +68 -0
- data/vendor/gems/htmlentities-4.0.0/COPYING.txt +21 -0
- data/vendor/gems/htmlentities-4.0.0/History.txt +47 -0
- data/vendor/gems/htmlentities-4.0.0/README.txt +44 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities.rb +165 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities/html4.rb +257 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities/legacy.rb +27 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities/string.rb +26 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities/xhtml1.rb +258 -0
- data/vendor/gems/htmlentities-4.0.0/test/entities_test.rb +206 -0
- data/vendor/gems/htmlentities-4.0.0/test/html4_test.rb +24 -0
- data/vendor/gems/htmlentities-4.0.0/test/legacy_test.rb +34 -0
- data/vendor/gems/htmlentities-4.0.0/test/roundtrip_test.rb +94 -0
- data/vendor/gems/htmlentities-4.0.0/test/string_test.rb +24 -0
- data/vendor/gems/htmlentities-4.0.0/test/test_all.rb +3 -0
- data/vendor/gems/htmlentities-4.0.0/test/xhtml1_test.rb +23 -0
- data/vendor/gems/json-1.1.3/.require_paths +4 -0
- data/vendor/gems/json-1.1.3/.specification +58 -0
- data/vendor/gems/json-1.1.3/CHANGES +93 -0
- data/vendor/gems/json-1.1.3/GPL +340 -0
- data/vendor/gems/json-1.1.3/README +78 -0
- data/vendor/gems/json-1.1.3/RUBY +58 -0
- data/vendor/gems/json-1.1.3/Rakefile +309 -0
- data/vendor/gems/json-1.1.3/TODO +1 -0
- data/vendor/gems/json-1.1.3/VERSION +1 -0
- data/vendor/gems/json-1.1.3/benchmarks/benchmark.txt +133 -0
- data/vendor/gems/json-1.1.3/benchmarks/benchmark_generator.rb +48 -0
- data/vendor/gems/json-1.1.3/benchmarks/benchmark_parser.rb +26 -0
- data/vendor/gems/json-1.1.3/benchmarks/benchmark_rails.rb +26 -0
- data/vendor/gems/json-1.1.3/bin/edit_json.rb +10 -0
- data/vendor/gems/json-1.1.3/bin/prettify_json.rb +76 -0
- data/vendor/gems/json-1.1.3/data/example.json +1 -0
- data/vendor/gems/json-1.1.3/data/index.html +38 -0
- data/vendor/gems/json-1.1.3/data/prototype.js +4184 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator.bundle +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/Makefile +149 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/extconf.rb +9 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/generator.bundle +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/generator.c +875 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/generator.o +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/unicode.c +182 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/unicode.h +53 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/unicode.o +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser.bundle +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/Makefile +149 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/extconf.rb +9 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/parser.bundle +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/parser.c +1758 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/parser.o +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/parser.rl +638 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/unicode.c +154 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/unicode.h +58 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/unicode.o +0 -0
- data/vendor/gems/json-1.1.3/install.rb +26 -0
- data/vendor/gems/json-1.1.3/lib/json.rb +235 -0
- data/vendor/gems/json-1.1.3/lib/json/Array.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/FalseClass.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/Hash.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/Key.xpm +73 -0
- data/vendor/gems/json-1.1.3/lib/json/NilClass.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/Numeric.xpm +28 -0
- data/vendor/gems/json-1.1.3/lib/json/String.xpm +96 -0
- data/vendor/gems/json-1.1.3/lib/json/TrueClass.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/add/core.rb +135 -0
- data/vendor/gems/json-1.1.3/lib/json/add/rails.rb +58 -0
- data/vendor/gems/json-1.1.3/lib/json/common.rb +354 -0
- data/vendor/gems/json-1.1.3/lib/json/editor.rb +1362 -0
- data/vendor/gems/json-1.1.3/lib/json/ext.rb +13 -0
- data/vendor/gems/json-1.1.3/lib/json/json.xpm +1499 -0
- data/vendor/gems/json-1.1.3/lib/json/pure.rb +75 -0
- data/vendor/gems/json-1.1.3/lib/json/pure/generator.rb +394 -0
- data/vendor/gems/json-1.1.3/lib/json/pure/parser.rb +259 -0
- data/vendor/gems/json-1.1.3/lib/json/version.rb +9 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail1.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail10.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail11.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail12.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail13.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail14.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail18.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail19.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail2.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail20.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail21.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail22.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail23.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail24.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail25.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail27.json +2 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail28.json +2 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail3.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail4.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail5.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail6.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail7.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail8.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail9.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass1.json +56 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass15.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass16.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass17.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass2.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass26.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass3.json +6 -0
- data/vendor/gems/json-1.1.3/tests/runner.rb +25 -0
- data/vendor/gems/json-1.1.3/tests/test_json.rb +293 -0
- data/vendor/gems/json-1.1.3/tests/test_json_addition.rb +161 -0
- data/vendor/gems/json-1.1.3/tests/test_json_fixtures.rb +30 -0
- data/vendor/gems/json-1.1.3/tests/test_json_generate.rb +100 -0
- data/vendor/gems/json-1.1.3/tests/test_json_rails.rb +118 -0
- data/vendor/gems/json-1.1.3/tests/test_json_unicode.rb +61 -0
- data/vendor/gems/json-1.1.3/tools/fuzz.rb +140 -0
- data/vendor/gems/json-1.1.3/tools/server.rb +62 -0
- data/vendor/plugins/localization/bin/make_language.rb +2 -2
- data/vendor/plugins/localization/lib/localization.rb +2 -2
- data/vendor/plugins/will_paginate/CHANGELOG.rdoc +110 -0
- data/vendor/plugins/will_paginate/LICENSE +18 -0
- data/vendor/plugins/will_paginate/README.rdoc +107 -0
- data/vendor/plugins/will_paginate/Rakefile +62 -0
- data/vendor/plugins/will_paginate/examples/apple-circle.gif +0 -0
- data/vendor/plugins/will_paginate/examples/index.haml +69 -0
- data/vendor/plugins/will_paginate/examples/index.html +92 -0
- data/vendor/plugins/will_paginate/examples/pagination.css +90 -0
- data/vendor/plugins/will_paginate/examples/pagination.sass +91 -0
- data/vendor/plugins/will_paginate/init.rb +1 -0
- data/vendor/plugins/will_paginate/lib/will_paginate.rb +82 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/array.rb +16 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/collection.rb +146 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb +32 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/finder.rb +260 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/named_scope.rb +170 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/named_scope_patch.rb +37 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/version.rb +9 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb +383 -0
- data/vendor/plugins/will_paginate/test/boot.rb +21 -0
- data/vendor/plugins/will_paginate/test/collection_test.rb +143 -0
- data/vendor/plugins/will_paginate/test/console +8 -0
- data/vendor/plugins/will_paginate/test/database.yml +22 -0
- data/vendor/plugins/will_paginate/test/finder_test.rb +476 -0
- data/vendor/plugins/will_paginate/test/fixtures/admin.rb +3 -0
- data/vendor/plugins/will_paginate/test/fixtures/developer.rb +14 -0
- data/vendor/plugins/will_paginate/test/fixtures/developers_projects.yml +13 -0
- data/vendor/plugins/will_paginate/test/fixtures/project.rb +15 -0
- data/vendor/plugins/will_paginate/test/fixtures/projects.yml +6 -0
- data/vendor/plugins/will_paginate/test/fixtures/replies.yml +29 -0
- data/vendor/plugins/will_paginate/test/fixtures/reply.rb +7 -0
- data/vendor/plugins/will_paginate/test/fixtures/schema.rb +38 -0
- data/vendor/plugins/will_paginate/test/fixtures/topic.rb +10 -0
- data/vendor/plugins/will_paginate/test/fixtures/topics.yml +30 -0
- data/vendor/plugins/will_paginate/test/fixtures/user.rb +2 -0
- data/vendor/plugins/will_paginate/test/fixtures/users.yml +35 -0
- data/vendor/plugins/will_paginate/test/helper.rb +37 -0
- data/vendor/plugins/will_paginate/test/lib/activerecord_test_case.rb +36 -0
- data/vendor/plugins/will_paginate/test/lib/activerecord_test_connector.rb +73 -0
- data/vendor/plugins/will_paginate/test/lib/load_fixtures.rb +11 -0
- data/vendor/plugins/will_paginate/test/lib/view_test_process.rb +165 -0
- data/vendor/plugins/will_paginate/test/tasks.rake +59 -0
- data/vendor/plugins/will_paginate/test/view_test.rb +363 -0
- data/vendor/plugins/will_paginate/will_paginate.gemspec +22 -0
- data/vendor/plugins/xml_sidebar/lib/xml_sidebar.rb +1 -1
- metadata +349 -16
- data/migrate.txt +0 -142
@@ -0,0 +1,154 @@
|
|
1
|
+
#include "unicode.h"
|
2
|
+
|
3
|
+
/*
|
4
|
+
* Copyright 2001-2004 Unicode, Inc.
|
5
|
+
*
|
6
|
+
* Disclaimer
|
7
|
+
*
|
8
|
+
* This source code is provided as is by Unicode, Inc. No claims are
|
9
|
+
* made as to fitness for any particular purpose. No warranties of any
|
10
|
+
* kind are expressed or implied. The recipient agrees to determine
|
11
|
+
* applicability of information provided. If this file has been
|
12
|
+
* purchased on magnetic or optical media from Unicode, Inc., the
|
13
|
+
* sole remedy for any claim will be exchange of defective media
|
14
|
+
* within 90 days of receipt.
|
15
|
+
*
|
16
|
+
* Limitations on Rights to Redistribute This Code
|
17
|
+
*
|
18
|
+
* Unicode, Inc. hereby grants the right to freely use the information
|
19
|
+
* supplied in this file in the creation of products supporting the
|
20
|
+
* Unicode Standard, and to make copies of this file in any form
|
21
|
+
* for internal or external distribution as long as this notice
|
22
|
+
* remains attached.
|
23
|
+
*/
|
24
|
+
|
25
|
+
/*
|
26
|
+
* Index into the table below with the first byte of a UTF-8 sequence to
|
27
|
+
* get the number of trailing bytes that are supposed to follow it.
|
28
|
+
* Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is
|
29
|
+
* left as-is for anyone who may want to do such conversion, which was
|
30
|
+
* allowed in earlier algorithms.
|
31
|
+
*/
|
32
|
+
static const char trailingBytesForUTF8[256] = {
|
33
|
+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
34
|
+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
35
|
+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
36
|
+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
37
|
+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
38
|
+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
39
|
+
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
40
|
+
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
|
41
|
+
};
|
42
|
+
|
43
|
+
/*
|
44
|
+
* Magic values subtracted from a buffer value during UTF8 conversion.
|
45
|
+
* This table contains as many values as there might be trailing bytes
|
46
|
+
* in a UTF-8 sequence.
|
47
|
+
*/
|
48
|
+
static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
|
49
|
+
0x03C82080UL, 0xFA082080UL, 0x82082080UL };
|
50
|
+
|
51
|
+
/*
|
52
|
+
* Once the bits are split out into bytes of UTF-8, this is a mask OR-ed
|
53
|
+
* into the first byte, depending on how many bytes follow. There are
|
54
|
+
* as many entries in this table as there are UTF-8 sequence types.
|
55
|
+
* (I.e., one byte sequence, two byte... etc.). Remember that sequencs
|
56
|
+
* for *legal* UTF-8 will be 4 or fewer bytes total.
|
57
|
+
*/
|
58
|
+
static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
|
59
|
+
|
60
|
+
char *JSON_convert_UTF16_to_UTF8 (
|
61
|
+
VALUE buffer,
|
62
|
+
char *source,
|
63
|
+
char *sourceEnd,
|
64
|
+
ConversionFlags flags)
|
65
|
+
{
|
66
|
+
UTF16 *tmp, *tmpPtr, *tmpEnd;
|
67
|
+
char buf[5];
|
68
|
+
long n = 0, i;
|
69
|
+
char *p = source - 1;
|
70
|
+
|
71
|
+
while (p < sourceEnd && p[0] == '\\' && p[1] == 'u') {
|
72
|
+
p += 6;
|
73
|
+
n++;
|
74
|
+
}
|
75
|
+
p = source + 1;
|
76
|
+
buf[4] = 0;
|
77
|
+
tmpPtr = tmp = ALLOC_N(UTF16, n);
|
78
|
+
tmpEnd = tmp + n;
|
79
|
+
for (i = 0; i < n; i++) {
|
80
|
+
buf[0] = *p++;
|
81
|
+
buf[1] = *p++;
|
82
|
+
buf[2] = *p++;
|
83
|
+
buf[3] = *p++;
|
84
|
+
tmpPtr[i] = strtol(buf, NULL, 16);
|
85
|
+
p += 2;
|
86
|
+
}
|
87
|
+
|
88
|
+
while (tmpPtr < tmpEnd) {
|
89
|
+
UTF32 ch;
|
90
|
+
unsigned short bytesToWrite = 0;
|
91
|
+
const UTF32 byteMask = 0xBF;
|
92
|
+
const UTF32 byteMark = 0x80;
|
93
|
+
ch = *tmpPtr++;
|
94
|
+
/* If we have a surrogate pair, convert to UTF32 first. */
|
95
|
+
if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
|
96
|
+
/* If the 16 bits following the high surrogate are in the source
|
97
|
+
* buffer... */
|
98
|
+
if (tmpPtr < tmpEnd) {
|
99
|
+
UTF32 ch2 = *tmpPtr;
|
100
|
+
/* If it's a low surrogate, convert to UTF32. */
|
101
|
+
if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
|
102
|
+
ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
|
103
|
+
+ (ch2 - UNI_SUR_LOW_START) + halfBase;
|
104
|
+
++tmpPtr;
|
105
|
+
} else if (flags == strictConversion) { /* it's an unpaired high surrogate */
|
106
|
+
free(tmp);
|
107
|
+
rb_raise(rb_path2class("JSON::ParserError"),
|
108
|
+
"source sequence is illegal/malformed near %s", source);
|
109
|
+
}
|
110
|
+
} else { /* We don't have the 16 bits following the high surrogate. */
|
111
|
+
free(tmp);
|
112
|
+
rb_raise(rb_path2class("JSON::ParserError"),
|
113
|
+
"partial character in source, but hit end near %s", source);
|
114
|
+
break;
|
115
|
+
}
|
116
|
+
} else if (flags == strictConversion) {
|
117
|
+
/* UTF-16 surrogate values are illegal in UTF-32 */
|
118
|
+
if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
|
119
|
+
free(tmp);
|
120
|
+
rb_raise(rb_path2class("JSON::ParserError"),
|
121
|
+
"source sequence is illegal/malformed near %s", source);
|
122
|
+
}
|
123
|
+
}
|
124
|
+
/* Figure out how many bytes the result will require */
|
125
|
+
if (ch < (UTF32) 0x80) {
|
126
|
+
bytesToWrite = 1;
|
127
|
+
} else if (ch < (UTF32) 0x800) {
|
128
|
+
bytesToWrite = 2;
|
129
|
+
} else if (ch < (UTF32) 0x10000) {
|
130
|
+
bytesToWrite = 3;
|
131
|
+
} else if (ch < (UTF32) 0x110000) {
|
132
|
+
bytesToWrite = 4;
|
133
|
+
} else {
|
134
|
+
bytesToWrite = 3;
|
135
|
+
ch = UNI_REPLACEMENT_CHAR;
|
136
|
+
}
|
137
|
+
|
138
|
+
buf[0] = 0;
|
139
|
+
buf[1] = 0;
|
140
|
+
buf[2] = 0;
|
141
|
+
buf[3] = 0;
|
142
|
+
p = buf + bytesToWrite;
|
143
|
+
switch (bytesToWrite) { /* note: everything falls through. */
|
144
|
+
case 4: *--p = (UTF8) ((ch | byteMark) & byteMask); ch >>= 6;
|
145
|
+
case 3: *--p = (UTF8) ((ch | byteMark) & byteMask); ch >>= 6;
|
146
|
+
case 2: *--p = (UTF8) ((ch | byteMark) & byteMask); ch >>= 6;
|
147
|
+
case 1: *--p = (UTF8) (ch | firstByteMark[bytesToWrite]);
|
148
|
+
}
|
149
|
+
rb_str_buf_cat(buffer, p, bytesToWrite);
|
150
|
+
}
|
151
|
+
free(tmp);
|
152
|
+
source += 5 + (n - 1) * 6;
|
153
|
+
return source;
|
154
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
|
2
|
+
#ifndef _PARSER_UNICODE_H_
|
3
|
+
#define _PARSER_UNICODE_H_
|
4
|
+
|
5
|
+
#include "ruby.h"
|
6
|
+
|
7
|
+
typedef unsigned long UTF32; /* at least 32 bits */
|
8
|
+
typedef unsigned short UTF16; /* at least 16 bits */
|
9
|
+
typedef unsigned char UTF8; /* typically 8 bits */
|
10
|
+
|
11
|
+
#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
|
12
|
+
#define UNI_MAX_BMP (UTF32)0x0000FFFF
|
13
|
+
#define UNI_MAX_UTF16 (UTF32)0x0010FFFF
|
14
|
+
#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF
|
15
|
+
#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF
|
16
|
+
|
17
|
+
#define UNI_SUR_HIGH_START (UTF32)0xD800
|
18
|
+
#define UNI_SUR_HIGH_END (UTF32)0xDBFF
|
19
|
+
#define UNI_SUR_LOW_START (UTF32)0xDC00
|
20
|
+
#define UNI_SUR_LOW_END (UTF32)0xDFFF
|
21
|
+
|
22
|
+
static const int halfShift = 10; /* used for shifting by 10 bits */
|
23
|
+
|
24
|
+
static const UTF32 halfBase = 0x0010000UL;
|
25
|
+
static const UTF32 halfMask = 0x3FFUL;
|
26
|
+
|
27
|
+
typedef enum {
|
28
|
+
conversionOK = 0, /* conversion successful */
|
29
|
+
sourceExhausted, /* partial character in source, but hit end */
|
30
|
+
targetExhausted, /* insuff. room in target for conversion */
|
31
|
+
sourceIllegal /* source sequence is illegal/malformed */
|
32
|
+
} ConversionResult;
|
33
|
+
|
34
|
+
typedef enum {
|
35
|
+
strictConversion = 0,
|
36
|
+
lenientConversion
|
37
|
+
} ConversionFlags;
|
38
|
+
|
39
|
+
char *JSON_convert_UTF16_to_UTF8 (
|
40
|
+
VALUE buffer,
|
41
|
+
char *source,
|
42
|
+
char *sourceEnd,
|
43
|
+
ConversionFlags flags);
|
44
|
+
|
45
|
+
#ifndef RARRAY_PTR
|
46
|
+
#define RARRAY_PTR(ARRAY) RARRAY(ARRAY)->ptr
|
47
|
+
#endif
|
48
|
+
#ifndef RARRAY_LEN
|
49
|
+
#define RARRAY_LEN(ARRAY) RARRAY(ARRAY)->len
|
50
|
+
#endif
|
51
|
+
#ifndef RSTRING_PTR
|
52
|
+
#define RSTRING_PTR(string) RSTRING(string)->ptr
|
53
|
+
#endif
|
54
|
+
#ifndef RSTRING_LEN
|
55
|
+
#define RSTRING_LEN(string) RSTRING(string)->len
|
56
|
+
#endif
|
57
|
+
|
58
|
+
#endif
|
Binary file
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rbconfig'
|
4
|
+
require 'fileutils'
|
5
|
+
include FileUtils::Verbose
|
6
|
+
|
7
|
+
include Config
|
8
|
+
|
9
|
+
bindir = CONFIG["bindir"]
|
10
|
+
cd 'bin' do
|
11
|
+
filename = 'edit_json.rb'
|
12
|
+
#install(filename, bindir)
|
13
|
+
end
|
14
|
+
sitelibdir = CONFIG["sitelibdir"]
|
15
|
+
cd 'lib' do
|
16
|
+
install('json.rb', sitelibdir)
|
17
|
+
mkdir_p File.join(sitelibdir, 'json')
|
18
|
+
for file in Dir['json/**/*.{rb,xpm}']
|
19
|
+
d = File.join(sitelibdir, file)
|
20
|
+
mkdir_p File.dirname(d)
|
21
|
+
install(file, d)
|
22
|
+
end
|
23
|
+
install(File.join('json', 'editor.rb'), File.join(sitelibdir,'json'))
|
24
|
+
install(File.join('json', 'json.xpm'), File.join(sitelibdir,'json'))
|
25
|
+
end
|
26
|
+
warn " *** Installed PURE ruby library."
|
@@ -0,0 +1,235 @@
|
|
1
|
+
require 'json/common'
|
2
|
+
# = json - JSON for Ruby
|
3
|
+
#
|
4
|
+
# == Description
|
5
|
+
#
|
6
|
+
# This is a implementation of the JSON specification according to RFC 4627
|
7
|
+
# (http://www.ietf.org/rfc/rfc4627.txt). Starting from version 1.0.0 on there
|
8
|
+
# will be two variants available:
|
9
|
+
#
|
10
|
+
# * A pure ruby variant, that relies on the iconv and the stringscan
|
11
|
+
# extensions, which are both part of the ruby standard library.
|
12
|
+
# * The quite a bit faster C extension variant, which is in parts implemented
|
13
|
+
# in C and comes with its own unicode conversion functions and a parser
|
14
|
+
# generated by the ragel state machine compiler
|
15
|
+
# (http://www.cs.queensu.ca/~thurston/ragel).
|
16
|
+
#
|
17
|
+
# Both variants of the JSON generator escape all non-ASCII an control
|
18
|
+
# characters with \uXXXX escape sequences, and support UTF-16 surrogate pairs
|
19
|
+
# in order to be able to generate the whole range of unicode code points. This
|
20
|
+
# means that generated JSON text is encoded as UTF-8 (because ASCII is a subset
|
21
|
+
# of UTF-8) and at the same time avoids decoding problems for receiving
|
22
|
+
# endpoints, that don't expect UTF-8 encoded texts. On the negative side this
|
23
|
+
# may lead to a bit longer strings than necessarry.
|
24
|
+
#
|
25
|
+
# All strings, that are to be encoded as JSON strings, should be UTF-8 byte
|
26
|
+
# sequences on the Ruby side. To encode raw binary strings, that aren't UTF-8
|
27
|
+
# encoded, please use the to_json_raw_object method of String (which produces
|
28
|
+
# an object, that contains a byte array) and decode the result on the receiving
|
29
|
+
# endpoint.
|
30
|
+
#
|
31
|
+
# == Author
|
32
|
+
#
|
33
|
+
# Florian Frank <mailto:flori@ping.de>
|
34
|
+
#
|
35
|
+
# == License
|
36
|
+
#
|
37
|
+
# This software is distributed under the same license as Ruby itself, see
|
38
|
+
# http://www.ruby-lang.org/en/LICENSE.txt.
|
39
|
+
#
|
40
|
+
# == Download
|
41
|
+
#
|
42
|
+
# The latest version of this library can be downloaded at
|
43
|
+
#
|
44
|
+
# * http://rubyforge.org/frs?group_id=953
|
45
|
+
#
|
46
|
+
# Online Documentation should be located at
|
47
|
+
#
|
48
|
+
# * http://json.rubyforge.org
|
49
|
+
#
|
50
|
+
# == Usage
|
51
|
+
#
|
52
|
+
# To use JSON you can
|
53
|
+
# require 'json'
|
54
|
+
# to load the installed variant (either the extension 'json' or the pure
|
55
|
+
# variant 'json_pure'). If you have installed the extension variant, you can
|
56
|
+
# pick either the extension variant or the pure variant by typing
|
57
|
+
# require 'json/ext'
|
58
|
+
# or
|
59
|
+
# require 'json/pure'
|
60
|
+
#
|
61
|
+
# You can choose to load a set of common additions to ruby core's objects if
|
62
|
+
# you
|
63
|
+
# require 'json/add/core'
|
64
|
+
#
|
65
|
+
# After requiring this you can, e. g., serialise/deserialise Ruby ranges:
|
66
|
+
#
|
67
|
+
# JSON JSON(1..10) # => 1..10
|
68
|
+
#
|
69
|
+
# To find out how to add JSON support to other or your own classes, read the
|
70
|
+
# Examples section below.
|
71
|
+
#
|
72
|
+
# To get the best compatibility to rails' JSON implementation, you can
|
73
|
+
# require 'json/add/rails'
|
74
|
+
#
|
75
|
+
# Both of the additions attempt to require 'json' (like above) first, if it has
|
76
|
+
# not been required yet.
|
77
|
+
#
|
78
|
+
# == Speed Comparisons
|
79
|
+
#
|
80
|
+
# I have created some benchmark results (see the benchmarks subdir of the
|
81
|
+
# package) for the JSON-Parser to estimate the speed up in the C extension:
|
82
|
+
#
|
83
|
+
# JSON::Pure::Parser:: 28.90 calls/second
|
84
|
+
# JSON::Ext::Parser:: 505.50 calls/second
|
85
|
+
#
|
86
|
+
# This is ca. <b>17.5</b> times the speed of the pure Ruby implementation.
|
87
|
+
#
|
88
|
+
# I have benchmarked the JSON-Generator as well. This generates a few more
|
89
|
+
# values, because there are different modes, that also influence the achieved
|
90
|
+
# speed:
|
91
|
+
#
|
92
|
+
# * JSON::Pure::Generator:
|
93
|
+
# generate:: 35.06 calls/second
|
94
|
+
# pretty_generate:: 34.00 calls/second
|
95
|
+
# fast_generate:: 41.06 calls/second
|
96
|
+
#
|
97
|
+
# * JSON::Ext::Generator:
|
98
|
+
# generate:: 492.11 calls/second
|
99
|
+
# pretty_generate:: 348.85 calls/second
|
100
|
+
# fast_generate:: 541.60 calls/second
|
101
|
+
#
|
102
|
+
# * Speedup Ext/Pure:
|
103
|
+
# generate safe:: 14.0 times
|
104
|
+
# generate pretty:: 10.3 times
|
105
|
+
# generate fast:: 13.2 times
|
106
|
+
#
|
107
|
+
# The rails framework includes a generator as well, also it seems to be rather
|
108
|
+
# slow: I measured only 23.87 calls/second which is slower than any of my pure
|
109
|
+
# generator results. Here a comparison of the different speedups with the Rails
|
110
|
+
# measurement as the divisor:
|
111
|
+
#
|
112
|
+
# * Speedup Pure/Rails:
|
113
|
+
# generate safe:: 1.5 times
|
114
|
+
# generate pretty:: 1.4 times
|
115
|
+
# generate fast:: 1.7 times
|
116
|
+
#
|
117
|
+
# * Speedup Ext/Rails:
|
118
|
+
# generate safe:: 20.6 times
|
119
|
+
# generate pretty:: 14.6 times
|
120
|
+
# generate fast:: 22.7 times
|
121
|
+
#
|
122
|
+
# To achieve the fastest JSON text output, you can use the
|
123
|
+
# fast_generate/fast_unparse methods. Beware, that this will disable the
|
124
|
+
# checking for circular Ruby data structures, which may cause JSON to go into
|
125
|
+
# an infinite loop.
|
126
|
+
#
|
127
|
+
# == Examples
|
128
|
+
#
|
129
|
+
# To create a JSON text from a ruby data structure, you
|
130
|
+
# can call JSON.generate (or JSON.unparse) like that:
|
131
|
+
#
|
132
|
+
# json = JSON.generate [1, 2, {"a"=>3.141}, false, true, nil, 4..10]
|
133
|
+
# # => "[1,2,{\"a\":3.141},false,true,null,\"4..10\"]"
|
134
|
+
#
|
135
|
+
# To create a valid JSON text you have to make sure, that the output is
|
136
|
+
# embedded in either a JSON array [] or a JSON object {}. The easiest way to do
|
137
|
+
# this, is by putting your values in a Ruby Array or Hash instance.
|
138
|
+
#
|
139
|
+
# To get back a ruby data structure from a JSON text, you have to call
|
140
|
+
# JSON.parse on it:
|
141
|
+
#
|
142
|
+
# JSON.parse json
|
143
|
+
# # => [1, 2, {"a"=>3.141}, false, true, nil, "4..10"]
|
144
|
+
#
|
145
|
+
# Note, that the range from the original data structure is a simple
|
146
|
+
# string now. The reason for this is, that JSON doesn't support ranges
|
147
|
+
# or arbitrary classes. In this case the json library falls back to call
|
148
|
+
# Object#to_json, which is the same as #to_s.to_json.
|
149
|
+
#
|
150
|
+
# It's possible to add JSON support serialization to arbitrary classes by
|
151
|
+
# simply implementing a more specialized version of the #to_json method, that
|
152
|
+
# should return a JSON object (a hash converted to JSON with #to_json) like
|
153
|
+
# this (don't forget the *a for all the arguments):
|
154
|
+
#
|
155
|
+
# class Range
|
156
|
+
# def to_json(*a)
|
157
|
+
# {
|
158
|
+
# 'json_class' => self.class.name, # = 'Range'
|
159
|
+
# 'data' => [ first, last, exclude_end? ]
|
160
|
+
# }.to_json(*a)
|
161
|
+
# end
|
162
|
+
# end
|
163
|
+
#
|
164
|
+
# The hash key 'json_class' is the class, that will be asked to deserialise the
|
165
|
+
# JSON representation later. In this case it's 'Range', but any namespace of
|
166
|
+
# the form 'A::B' or '::A::B' will do. All other keys are arbitrary and can be
|
167
|
+
# used to store the necessary data to configure the object to be deserialised.
|
168
|
+
#
|
169
|
+
# If a the key 'json_class' is found in a JSON object, the JSON parser checks
|
170
|
+
# if the given class responds to the json_create class method. If so, it is
|
171
|
+
# called with the JSON object converted to a Ruby hash. So a range can
|
172
|
+
# be deserialised by implementing Range.json_create like this:
|
173
|
+
#
|
174
|
+
# class Range
|
175
|
+
# def self.json_create(o)
|
176
|
+
# new(*o['data'])
|
177
|
+
# end
|
178
|
+
# end
|
179
|
+
#
|
180
|
+
# Now it possible to serialise/deserialise ranges as well:
|
181
|
+
#
|
182
|
+
# json = JSON.generate [1, 2, {"a"=>3.141}, false, true, nil, 4..10]
|
183
|
+
# # => "[1,2,{\"a\":3.141},false,true,null,{\"json_class\":\"Range\",\"data\":[4,10,false]}]"
|
184
|
+
# JSON.parse json
|
185
|
+
# # => [1, 2, {"a"=>3.141}, false, true, nil, 4..10]
|
186
|
+
#
|
187
|
+
# JSON.generate always creates the shortest possible string representation of a
|
188
|
+
# ruby data structure in one line. This good for data storage or network
|
189
|
+
# protocols, but not so good for humans to read. Fortunately there's also
|
190
|
+
# JSON.pretty_generate (or JSON.pretty_generate) that creates a more
|
191
|
+
# readable output:
|
192
|
+
#
|
193
|
+
# puts JSON.pretty_generate([1, 2, {"a"=>3.141}, false, true, nil, 4..10])
|
194
|
+
# [
|
195
|
+
# 1,
|
196
|
+
# 2,
|
197
|
+
# {
|
198
|
+
# "a": 3.141
|
199
|
+
# },
|
200
|
+
# false,
|
201
|
+
# true,
|
202
|
+
# null,
|
203
|
+
# {
|
204
|
+
# "json_class": "Range",
|
205
|
+
# "data": [
|
206
|
+
# 4,
|
207
|
+
# 10,
|
208
|
+
# false
|
209
|
+
# ]
|
210
|
+
# }
|
211
|
+
# ]
|
212
|
+
#
|
213
|
+
# There are also the methods Kernel#j for unparse, and Kernel#jj for
|
214
|
+
# pretty_unparse output to the console, that work analogous to Core Ruby's p
|
215
|
+
# and the pp library's pp methods.
|
216
|
+
#
|
217
|
+
# The script tools/server.rb contains a small example if you want to test, how
|
218
|
+
# receiving a JSON object from a webrick server in your browser with the
|
219
|
+
# javasript prototype library (http://www.prototypejs.org) works.
|
220
|
+
#
|
221
|
+
module JSON
|
222
|
+
require 'json/version'
|
223
|
+
|
224
|
+
if VARIANT_BINARY
|
225
|
+
require 'json/ext'
|
226
|
+
else
|
227
|
+
begin
|
228
|
+
require 'json/ext'
|
229
|
+
rescue LoadError
|
230
|
+
require 'json/pure'
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
JSON_LOADED = true
|
235
|
+
end
|