logstash-output-scalyr 0.1.8 → 0.1.13
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 +4 -4
- data/CHANGELOG.md +27 -0
- data/Gemfile +5 -0
- data/README.md +3 -2
- data/lib/logstash/outputs/scalyr.rb +226 -138
- data/lib/scalyr/common/client.rb +76 -50
- data/lib/scalyr/common/util.rb +7 -0
- data/lib/scalyr/constants.rb +2 -0
- data/logstash-output-scalyr.gemspec +1 -1
- data/spec/logstash/outputs/scalyr_integration_spec.rb +148 -8
- data/spec/logstash/outputs/scalyr_spec.rb +12 -6
- data/vendor/bundle/jruby/2.5.0/bin/htmldiff +1 -1
- data/vendor/bundle/jruby/2.5.0/bin/ldiff +1 -1
- data/vendor/bundle/jruby/2.5.0/cache/addressable-2.7.0.gem +0 -0
- data/vendor/bundle/jruby/2.5.0/cache/crack-0.4.5.gem +0 -0
- data/vendor/bundle/jruby/2.5.0/cache/hashdiff-1.0.1.gem +0 -0
- data/vendor/bundle/jruby/2.5.0/cache/public_suffix-4.0.6.gem +0 -0
- data/vendor/bundle/jruby/2.5.0/cache/rexml-3.2.5.gem +0 -0
- data/vendor/bundle/jruby/2.5.0/cache/webmock-3.13.0.gem +0 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/CHANGELOG.md +235 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/Gemfile +32 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/LICENSE.txt +202 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/README.md +121 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/Rakefile +34 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/data/unicode.data +0 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable.rb +4 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/idna.rb +27 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/idna/native.rb +61 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/idna/pure.rb +676 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/template.rb +1045 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/uri.rb +2529 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/version.rb +32 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/idna_spec.rb +300 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/net_http_compat_spec.rb +30 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/rack_mount_compat_spec.rb +106 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/security_spec.rb +59 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/template_spec.rb +1451 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/uri_spec.rb +6603 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/spec_helper.rb +24 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/clobber.rake +4 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/gem.rake +93 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/git.rake +47 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/metrics.rake +24 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/rspec.rake +23 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/yard.rake +29 -0
- data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack.rb +7 -0
- data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/json.rb +98 -0
- data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/util.rb +17 -0
- data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/version.rb +3 -0
- data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/xml.rb +238 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/Gemfile +8 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/LICENSE +19 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/README.md +276 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/Rakefile +18 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/changelog.md +100 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/hashdiff.gemspec +39 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff.rb +10 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/compare_hashes.rb +69 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/diff.rb +177 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/lcs.rb +66 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/lcs_compare_arrays.rb +32 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/linear_compare_array.rb +159 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/patch.rb +88 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/util.rb +155 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/version.rb +5 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/best_diff_spec.rb +75 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/diff_array_spec.rb +60 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/diff_spec.rb +360 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/lcs_spec.rb +76 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/linear_compare_array_spec.rb +50 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/patch_spec.rb +185 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/readme_spec.rb +15 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/util_spec.rb +116 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/spec_helper.rb +15 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/2.0-Upgrade.md +52 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/CHANGELOG.md +406 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/Gemfile +15 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/LICENSE.txt +22 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/README.md +207 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/Rakefile +51 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/SECURITY.md +104 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/bin/console +15 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/codecov.yml +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/data/list.txt +13380 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix.rb +179 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/domain.rb +235 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/errors.rb +41 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/list.rb +247 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/rule.rb +350 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/version.rb +13 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/public_suffix.gemspec +29 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/acceptance_test.rb +131 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb +66 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find_all.rb +102 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_names.rb +91 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_select.rb +26 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_select_incremental.rb +25 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_valid.rb +101 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/domain_profiler.rb +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/find_profiler.rb +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/find_profiler_jp.rb +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/initialization_profiler.rb +11 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/list_profsize.rb +11 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/object_binsize.rb +57 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/psl_test.rb +52 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/test_helper.rb +18 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/tests.txt +98 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/domain_test.rb +106 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/errors_test.rb +25 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/list_test.rb +241 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/public_suffix_test.rb +188 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/rule_test.rb +222 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/LICENSE.txt +22 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/NEWS.md +178 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/README.md +48 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/context.rdoc +143 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/child.rdoc +87 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/document.rdoc +276 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/element.rdoc +602 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/node.rdoc +97 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/parent.rdoc +267 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/child_toc.rdoc +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/document_toc.rdoc +30 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/element_toc.rdoc +55 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/master_toc.rdoc +135 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/node_toc.rdoc +16 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/parent_toc.rdoc +25 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml.rb +3 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/attlistdecl.rb +63 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/attribute.rb +205 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/cdata.rb +68 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/child.rb +97 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/comment.rb +80 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/doctype.rb +311 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/document.rb +451 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/attlistdecl.rb +11 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/dtd.rb +47 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/elementdecl.rb +18 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/entitydecl.rb +57 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/notationdecl.rb +40 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/element.rb +2599 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/encoding.rb +51 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/entity.rb +171 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/formatters/default.rb +116 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/formatters/pretty.rb +142 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/formatters/transitive.rb +58 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/functions.rb +447 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/instruction.rb +79 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/light/node.rb +188 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/namespace.rb +59 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/node.rb +76 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/output.rb +30 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parent.rb +166 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parseexception.rb +52 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb +694 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/lightparser.rb +59 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/pullparser.rb +197 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/sax2parser.rb +273 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/streamparser.rb +61 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/treeparser.rb +101 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/ultralightparser.rb +57 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/xpathparser.rb +689 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/quickpath.rb +266 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/rexml.rb +37 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/sax2listener.rb +98 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/security.rb +28 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/source.rb +298 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/streamlistener.rb +93 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/text.rb +424 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/undefinednamespaceexception.rb +9 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/validation/relaxng.rb +539 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/validation/validation.rb +144 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/validation/validationexception.rb +10 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xmldecl.rb +130 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xmltokens.rb +85 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xpath.rb +81 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xpath_parser.rb +974 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/CHANGELOG.md +1894 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/Gemfile +9 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/LICENSE +20 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/README.md +1176 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/Rakefile +38 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock.rb +59 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/api.rb +109 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/assertion_failure.rb +11 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/callback_registry.rb +35 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/config.rb +18 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/cucumber.rb +10 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/deprecation.rb +9 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/errors.rb +17 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/async_http_client_adapter.rb +216 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/curb_adapter.rb +351 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +231 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/excon_adapter.rb +165 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_lib_adapter.rb +7 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_lib_adapter_registry.rb +19 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/client.rb +17 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/request.rb +16 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/response.rb +64 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/streamer.rb +29 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/webmock.rb +68 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb_adapter.rb +37 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/httpclient_adapter.rb +259 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/manticore_adapter.rb +145 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/net_http.rb +385 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/net_http_response.rb +34 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/patron_adapter.rb +130 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb +174 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/any_arg_matcher.rb +13 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/hash_argument_matcher.rb +21 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/hash_excluding_matcher.rb +15 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/hash_including_matcher.rb +17 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/minitest.rb +41 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rack_response.rb +69 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_body_diff.rb +64 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_execution_verifier.rb +77 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_pattern.rb +405 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_registry.rb +35 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_signature.rb +54 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_signature_snippet.rb +61 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_stub.rb +100 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/response.rb +159 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/responses_sequence.rb +40 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec.rb +42 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec/matchers.rb +27 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec/matchers/request_pattern_matcher.rb +78 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec/matchers/webmock_matcher.rb +67 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/stub_registry.rb +82 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/stub_request_snippet.rb +38 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/test_unit.rb +20 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/hash_counter.rb +39 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/hash_keys_stringifier.rb +25 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/hash_validator.rb +17 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/headers.rb +64 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/json.rb +67 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/query_mapper.rb +281 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/uri.rb +111 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/values_stringifier.rb +20 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/version_checker.rb +111 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/version.rb +3 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/webmock.rb +163 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/minitest/test_helper.rb +34 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/minitest/test_webmock.rb +9 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/minitest/webmock_spec.rb +60 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/async_http_client/async_http_client_spec.rb +375 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/async_http_client/async_http_client_spec_helper.rb +73 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/curb/curb_spec.rb +499 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/curb/curb_spec_helper.rb +147 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/em_http_request/em_http_request_spec.rb +462 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/em_http_request/em_http_request_spec_helper.rb +77 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/excon/excon_spec.rb +77 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/excon/excon_spec_helper.rb +52 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/http_rb/http_rb_spec.rb +93 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/http_rb/http_rb_spec_helper.rb +54 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/httpclient/httpclient_spec.rb +217 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/httpclient/httpclient_spec_helper.rb +57 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec.rb +107 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb +35 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/net_http_shared.rb +153 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/net_http_spec.rb +369 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/net_http_spec_helper.rb +64 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/real_net_http_spec.rb +20 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/patron/patron_spec.rb +125 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/patron/patron_spec_helper.rb +54 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/allowing_and_disabling_net_connect.rb +313 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/callbacks.rb +148 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/complex_cross_concern_behaviors.rb +36 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/enabling_and_disabling_webmock.rb +95 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/precedence_of_stubs.rb +15 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/request_expectations.rb +930 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/returning_declared_responses.rb +409 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/stubbing_requests.rb +678 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +135 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb +60 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/webmock_shared.rb +41 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/fixtures/test.txt +1 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/quality_spec.rb +84 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/spec_helper.rb +48 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/example_curl_output.txt +22 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/failures.rb +9 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/my_rack_app.rb +53 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/network_connection.rb +19 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/webmock_server.rb +70 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/api_spec.rb +175 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/errors_spec.rb +129 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/http_lib_adapters/http_lib_adapter_registry_spec.rb +17 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/http_lib_adapters/http_lib_adapter_spec.rb +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/matchers/hash_excluding_matcher_spec.rb +61 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/matchers/hash_including_matcher_spec.rb +87 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/rack_response_spec.rb +112 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_body_diff_spec.rb +90 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_execution_verifier_spec.rb +208 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_pattern_spec.rb +736 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_registry_spec.rb +95 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_signature_snippet_spec.rb +89 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_signature_spec.rb +155 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_stub_spec.rb +199 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/response_spec.rb +286 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/stub_registry_spec.rb +103 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/stub_request_snippet_spec.rb +115 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/hash_counter_spec.rb +39 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/hash_keys_stringifier_spec.rb +27 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/headers_spec.rb +28 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/json_spec.rb +33 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/query_mapper_spec.rb +157 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/uri_spec.rb +371 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/version_checker_spec.rb +65 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb +60 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/http_request.rb +24 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/shared_test.rb +108 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/test_helper.rb +23 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/test_webmock.rb +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/webmock.gemspec +54 -0
- data/vendor/bundle/jruby/2.5.0/specifications/addressable-2.7.0.gemspec +39 -0
- data/vendor/bundle/jruby/2.5.0/specifications/crack-0.4.5.gemspec +32 -0
- data/vendor/bundle/jruby/2.5.0/specifications/hashdiff-1.0.1.gemspec +46 -0
- data/vendor/bundle/jruby/2.5.0/specifications/public_suffix-4.0.6.gemspec +24 -0
- data/vendor/bundle/jruby/2.5.0/specifications/rexml-3.2.5.gemspec +42 -0
- data/vendor/bundle/jruby/2.5.0/specifications/webmock-3.13.0.gemspec +85 -0
- metadata +309 -2
@@ -0,0 +1,451 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
require_relative "security"
|
3
|
+
require_relative "element"
|
4
|
+
require_relative "xmldecl"
|
5
|
+
require_relative "source"
|
6
|
+
require_relative "comment"
|
7
|
+
require_relative "doctype"
|
8
|
+
require_relative "instruction"
|
9
|
+
require_relative "rexml"
|
10
|
+
require_relative "parseexception"
|
11
|
+
require_relative "output"
|
12
|
+
require_relative "parsers/baseparser"
|
13
|
+
require_relative "parsers/streamparser"
|
14
|
+
require_relative "parsers/treeparser"
|
15
|
+
|
16
|
+
module REXML
|
17
|
+
# Represents an XML document.
|
18
|
+
#
|
19
|
+
# A document may have:
|
20
|
+
#
|
21
|
+
# - A single child that may be accessed via method #root.
|
22
|
+
# - An XML declaration.
|
23
|
+
# - A document type.
|
24
|
+
# - Processing instructions.
|
25
|
+
#
|
26
|
+
# == In a Hurry?
|
27
|
+
#
|
28
|
+
# If you're somewhat familiar with XML
|
29
|
+
# and have a particular task in mind,
|
30
|
+
# you may want to see the
|
31
|
+
# {tasks pages}[../doc/rexml/tasks/tocs/master_toc_rdoc.html],
|
32
|
+
# and in particular, the
|
33
|
+
# {tasks page for documents}[../doc/rexml/tasks/tocs/document_toc_rdoc.html].
|
34
|
+
#
|
35
|
+
class Document < Element
|
36
|
+
# A convenient default XML declaration. Use:
|
37
|
+
#
|
38
|
+
# mydoc << XMLDecl.default
|
39
|
+
#
|
40
|
+
DECLARATION = XMLDecl.default
|
41
|
+
|
42
|
+
# :call-seq:
|
43
|
+
# new(string = nil, context = {}) -> new_document
|
44
|
+
# new(io_stream = nil, context = {}) -> new_document
|
45
|
+
# new(document = nil, context = {}) -> new_document
|
46
|
+
#
|
47
|
+
# Returns a new \REXML::Document object.
|
48
|
+
#
|
49
|
+
# When no arguments are given,
|
50
|
+
# returns an empty document:
|
51
|
+
#
|
52
|
+
# d = REXML::Document.new
|
53
|
+
# d.to_s # => ""
|
54
|
+
#
|
55
|
+
# When argument +string+ is given, it must be a string
|
56
|
+
# containing a valid XML document:
|
57
|
+
#
|
58
|
+
# xml_string = '<root><foo>Foo</foo><bar>Bar</bar></root>'
|
59
|
+
# d = REXML::Document.new(xml_string)
|
60
|
+
# d.to_s # => "<root><foo>Foo</foo><bar>Bar</bar></root>"
|
61
|
+
#
|
62
|
+
# When argument +io_stream+ is given, it must be an \IO object
|
63
|
+
# that is opened for reading, and when read must return a valid XML document:
|
64
|
+
#
|
65
|
+
# File.write('t.xml', xml_string)
|
66
|
+
# d = File.open('t.xml', 'r') do |io|
|
67
|
+
# REXML::Document.new(io)
|
68
|
+
# end
|
69
|
+
# d.to_s # => "<root><foo>Foo</foo><bar>Bar</bar></root>"
|
70
|
+
#
|
71
|
+
# When argument +document+ is given, it must be an existing
|
72
|
+
# document object, whose context and attributes (but not chidren)
|
73
|
+
# are cloned into the new document:
|
74
|
+
#
|
75
|
+
# d = REXML::Document.new(xml_string)
|
76
|
+
# d.children # => [<root> ... </>]
|
77
|
+
# d.context = {raw: :all, compress_whitespace: :all}
|
78
|
+
# d.add_attributes({'bar' => 0, 'baz' => 1})
|
79
|
+
# d1 = REXML::Document.new(d)
|
80
|
+
# d1.children # => []
|
81
|
+
# d1.context # => {:raw=>:all, :compress_whitespace=>:all}
|
82
|
+
# d1.attributes # => {"bar"=>bar='0', "baz"=>baz='1'}
|
83
|
+
#
|
84
|
+
# When argument +context+ is given, it must be a hash
|
85
|
+
# containing context entries for the document;
|
86
|
+
# see {Element Context}[../doc/rexml/context_rdoc.html]:
|
87
|
+
#
|
88
|
+
# context = {raw: :all, compress_whitespace: :all}
|
89
|
+
# d = REXML::Document.new(xml_string, context)
|
90
|
+
# d.context # => {:raw=>:all, :compress_whitespace=>:all}
|
91
|
+
#
|
92
|
+
def initialize( source = nil, context = {} )
|
93
|
+
@entity_expansion_count = 0
|
94
|
+
super()
|
95
|
+
@context = context
|
96
|
+
return if source.nil?
|
97
|
+
if source.kind_of? Document
|
98
|
+
@context = source.context
|
99
|
+
super source
|
100
|
+
else
|
101
|
+
build( source )
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# :call-seq:
|
106
|
+
# node_type -> :document
|
107
|
+
#
|
108
|
+
# Returns the symbol +:document+.
|
109
|
+
#
|
110
|
+
def node_type
|
111
|
+
:document
|
112
|
+
end
|
113
|
+
|
114
|
+
# :call-seq:
|
115
|
+
# clone -> new_document
|
116
|
+
#
|
117
|
+
# Returns the new document resulting from executing
|
118
|
+
# <tt>Document.new(self)</tt>. See Document.new.
|
119
|
+
#
|
120
|
+
def clone
|
121
|
+
Document.new self
|
122
|
+
end
|
123
|
+
|
124
|
+
# :call-seq:
|
125
|
+
# expanded_name -> empty_string
|
126
|
+
#
|
127
|
+
# Returns an empty string.
|
128
|
+
#
|
129
|
+
def expanded_name
|
130
|
+
''
|
131
|
+
#d = doc_type
|
132
|
+
#d ? d.name : "UNDEFINED"
|
133
|
+
end
|
134
|
+
alias :name :expanded_name
|
135
|
+
|
136
|
+
# :call-seq:
|
137
|
+
# add(xml_decl) -> self
|
138
|
+
# add(doc_type) -> self
|
139
|
+
# add(object) -> self
|
140
|
+
#
|
141
|
+
# Adds an object to the document; returns +self+.
|
142
|
+
#
|
143
|
+
# When argument +xml_decl+ is given,
|
144
|
+
# it must be an REXML::XMLDecl object,
|
145
|
+
# which becomes the XML declaration for the document,
|
146
|
+
# replacing the previous XML declaration if any:
|
147
|
+
#
|
148
|
+
# d = REXML::Document.new
|
149
|
+
# d.xml_decl.to_s # => ""
|
150
|
+
# d.add(REXML::XMLDecl.new('2.0'))
|
151
|
+
# d.xml_decl.to_s # => "<?xml version='2.0'?>"
|
152
|
+
#
|
153
|
+
# When argument +doc_type+ is given,
|
154
|
+
# it must be an REXML::DocType object,
|
155
|
+
# which becomes the document type for the document,
|
156
|
+
# replacing the previous document type, if any:
|
157
|
+
#
|
158
|
+
# d = REXML::Document.new
|
159
|
+
# d.doctype.to_s # => ""
|
160
|
+
# d.add(REXML::DocType.new('foo'))
|
161
|
+
# d.doctype.to_s # => "<!DOCTYPE foo>"
|
162
|
+
#
|
163
|
+
# When argument +object+ (not an REXML::XMLDecl or REXML::DocType object)
|
164
|
+
# is given it is added as the last child:
|
165
|
+
#
|
166
|
+
# d = REXML::Document.new
|
167
|
+
# d.add(REXML::Element.new('foo'))
|
168
|
+
# d.to_s # => "<foo/>"
|
169
|
+
#
|
170
|
+
def add( child )
|
171
|
+
if child.kind_of? XMLDecl
|
172
|
+
if @children[0].kind_of? XMLDecl
|
173
|
+
@children[0] = child
|
174
|
+
else
|
175
|
+
@children.unshift child
|
176
|
+
end
|
177
|
+
child.parent = self
|
178
|
+
elsif child.kind_of? DocType
|
179
|
+
# Find first Element or DocType node and insert the decl right
|
180
|
+
# before it. If there is no such node, just insert the child at the
|
181
|
+
# end. If there is a child and it is an DocType, then replace it.
|
182
|
+
insert_before_index = @children.find_index { |x|
|
183
|
+
x.kind_of?(Element) || x.kind_of?(DocType)
|
184
|
+
}
|
185
|
+
if insert_before_index # Not null = not end of list
|
186
|
+
if @children[ insert_before_index ].kind_of? DocType
|
187
|
+
@children[ insert_before_index ] = child
|
188
|
+
else
|
189
|
+
@children[ insert_before_index-1, 0 ] = child
|
190
|
+
end
|
191
|
+
else # Insert at end of list
|
192
|
+
@children << child
|
193
|
+
end
|
194
|
+
child.parent = self
|
195
|
+
else
|
196
|
+
rv = super
|
197
|
+
raise "attempted adding second root element to document" if @elements.size > 1
|
198
|
+
rv
|
199
|
+
end
|
200
|
+
end
|
201
|
+
alias :<< :add
|
202
|
+
|
203
|
+
# :call-seq:
|
204
|
+
# add_element(name_or_element = nil, attributes = nil) -> new_element
|
205
|
+
#
|
206
|
+
# Adds an element to the document by calling REXML::Element.add_element:
|
207
|
+
#
|
208
|
+
# REXML::Element.add_element(name_or_element, attributes)
|
209
|
+
def add_element(arg=nil, arg2=nil)
|
210
|
+
rv = super
|
211
|
+
raise "attempted adding second root element to document" if @elements.size > 1
|
212
|
+
rv
|
213
|
+
end
|
214
|
+
|
215
|
+
# :call-seq:
|
216
|
+
# root -> root_element or nil
|
217
|
+
#
|
218
|
+
# Returns the root element of the document, if it exists, otherwise +nil+:
|
219
|
+
#
|
220
|
+
# d = REXML::Document.new('<root></root>')
|
221
|
+
# d.root # => <root/>
|
222
|
+
# d = REXML::Document.new('')
|
223
|
+
# d.root # => nil
|
224
|
+
#
|
225
|
+
def root
|
226
|
+
elements[1]
|
227
|
+
#self
|
228
|
+
#@children.find { |item| item.kind_of? Element }
|
229
|
+
end
|
230
|
+
|
231
|
+
# :call-seq:
|
232
|
+
# doctype -> doc_type or nil
|
233
|
+
#
|
234
|
+
# Returns the DocType object for the document, if it exists, otherwise +nil+:
|
235
|
+
#
|
236
|
+
# d = REXML::Document.new('<!DOCTYPE document SYSTEM "subjects.dtd">')
|
237
|
+
# d.doctype.class # => REXML::DocType
|
238
|
+
# d = REXML::Document.new('')
|
239
|
+
# d.doctype.class # => nil
|
240
|
+
#
|
241
|
+
def doctype
|
242
|
+
@children.find { |item| item.kind_of? DocType }
|
243
|
+
end
|
244
|
+
|
245
|
+
# :call-seq:
|
246
|
+
# xml_decl -> xml_decl
|
247
|
+
#
|
248
|
+
# Returns the XMLDecl object for the document, if it exists,
|
249
|
+
# otherwise the default XMLDecl object:
|
250
|
+
#
|
251
|
+
# d = REXML::Document.new('<?xml version="1.0" encoding="UTF-8"?>')
|
252
|
+
# d.xml_decl.class # => REXML::XMLDecl
|
253
|
+
# d.xml_decl.to_s # => "<?xml version='1.0' encoding='UTF-8'?>"
|
254
|
+
# d = REXML::Document.new('')
|
255
|
+
# d.xml_decl.class # => REXML::XMLDecl
|
256
|
+
# d.xml_decl.to_s # => ""
|
257
|
+
#
|
258
|
+
def xml_decl
|
259
|
+
rv = @children[0]
|
260
|
+
return rv if rv.kind_of? XMLDecl
|
261
|
+
@children.unshift(XMLDecl.default)[0]
|
262
|
+
end
|
263
|
+
|
264
|
+
# :call-seq:
|
265
|
+
# version -> version_string
|
266
|
+
#
|
267
|
+
# Returns the XMLDecl version of this document as a string,
|
268
|
+
# if it has been set, otherwise the default version:
|
269
|
+
#
|
270
|
+
# d = REXML::Document.new('<?xml version="2.0" encoding="UTF-8"?>')
|
271
|
+
# d.version # => "2.0"
|
272
|
+
# d = REXML::Document.new('')
|
273
|
+
# d.version # => "1.0"
|
274
|
+
#
|
275
|
+
def version
|
276
|
+
xml_decl().version
|
277
|
+
end
|
278
|
+
|
279
|
+
# :call-seq:
|
280
|
+
# encoding -> encoding_string
|
281
|
+
#
|
282
|
+
# Returns the XMLDecl encoding of the document,
|
283
|
+
# if it has been set, otherwise the default encoding:
|
284
|
+
#
|
285
|
+
# d = REXML::Document.new('<?xml version="1.0" encoding="UTF-16"?>')
|
286
|
+
# d.encoding # => "UTF-16"
|
287
|
+
# d = REXML::Document.new('')
|
288
|
+
# d.encoding # => "UTF-8"
|
289
|
+
#
|
290
|
+
def encoding
|
291
|
+
xml_decl().encoding
|
292
|
+
end
|
293
|
+
|
294
|
+
# :call-seq:
|
295
|
+
# stand_alone?
|
296
|
+
#
|
297
|
+
# Returns the XMLDecl standalone value of the document as a string,
|
298
|
+
# if it has been set, otherwise the default standalone value:
|
299
|
+
#
|
300
|
+
# d = REXML::Document.new('<?xml standalone="yes"?>')
|
301
|
+
# d.stand_alone? # => "yes"
|
302
|
+
# d = REXML::Document.new('')
|
303
|
+
# d.stand_alone? # => nil
|
304
|
+
#
|
305
|
+
def stand_alone?
|
306
|
+
xml_decl().stand_alone?
|
307
|
+
end
|
308
|
+
|
309
|
+
# :call-seq:
|
310
|
+
# doc.write(output=$stdout, indent=-1, transtive=false, ie_hack=false, encoding=nil)
|
311
|
+
# doc.write(options={:output => $stdout, :indent => -1, :transtive => false, :ie_hack => false, :encoding => nil})
|
312
|
+
#
|
313
|
+
# Write the XML tree out, optionally with indent. This writes out the
|
314
|
+
# entire XML document, including XML declarations, doctype declarations,
|
315
|
+
# and processing instructions (if any are given).
|
316
|
+
#
|
317
|
+
# A controversial point is whether Document should always write the XML
|
318
|
+
# declaration (<?xml version='1.0'?>) whether or not one is given by the
|
319
|
+
# user (or source document). REXML does not write one if one was not
|
320
|
+
# specified, because it adds unnecessary bandwidth to applications such
|
321
|
+
# as XML-RPC.
|
322
|
+
#
|
323
|
+
# Accept Nth argument style and options Hash style as argument.
|
324
|
+
# The recommended style is options Hash style for one or more
|
325
|
+
# arguments case.
|
326
|
+
#
|
327
|
+
# _Examples_
|
328
|
+
# Document.new("<a><b/></a>").write
|
329
|
+
#
|
330
|
+
# output = ""
|
331
|
+
# Document.new("<a><b/></a>").write(output)
|
332
|
+
#
|
333
|
+
# output = ""
|
334
|
+
# Document.new("<a><b/></a>").write(:output => output, :indent => 2)
|
335
|
+
#
|
336
|
+
# See also the classes in the rexml/formatters package for the proper way
|
337
|
+
# to change the default formatting of XML output.
|
338
|
+
#
|
339
|
+
# _Examples_
|
340
|
+
#
|
341
|
+
# output = ""
|
342
|
+
# tr = Transitive.new
|
343
|
+
# tr.write(Document.new("<a><b/></a>"), output)
|
344
|
+
#
|
345
|
+
# output::
|
346
|
+
# output an object which supports '<< string'; this is where the
|
347
|
+
# document will be written.
|
348
|
+
# indent::
|
349
|
+
# An integer. If -1, no indenting will be used; otherwise, the
|
350
|
+
# indentation will be twice this number of spaces, and children will be
|
351
|
+
# indented an additional amount. For a value of 3, every item will be
|
352
|
+
# indented 3 more levels, or 6 more spaces (2 * 3). Defaults to -1
|
353
|
+
# transitive::
|
354
|
+
# If transitive is true and indent is >= 0, then the output will be
|
355
|
+
# pretty-printed in such a way that the added whitespace does not affect
|
356
|
+
# the absolute *value* of the document -- that is, it leaves the value
|
357
|
+
# and number of Text nodes in the document unchanged.
|
358
|
+
# ie_hack::
|
359
|
+
# This hack inserts a space before the /> on empty tags to address
|
360
|
+
# a limitation of Internet Explorer. Defaults to false
|
361
|
+
# encoding::
|
362
|
+
# Encoding name as String. Change output encoding to specified encoding
|
363
|
+
# instead of encoding in XML declaration.
|
364
|
+
# Defaults to nil. It means encoding in XML declaration is used.
|
365
|
+
def write(*arguments)
|
366
|
+
if arguments.size == 1 and arguments[0].class == Hash
|
367
|
+
options = arguments[0]
|
368
|
+
|
369
|
+
output = options[:output]
|
370
|
+
indent = options[:indent]
|
371
|
+
transitive = options[:transitive]
|
372
|
+
ie_hack = options[:ie_hack]
|
373
|
+
encoding = options[:encoding]
|
374
|
+
else
|
375
|
+
output, indent, transitive, ie_hack, encoding, = *arguments
|
376
|
+
end
|
377
|
+
|
378
|
+
output ||= $stdout
|
379
|
+
indent ||= -1
|
380
|
+
transitive = false if transitive.nil?
|
381
|
+
ie_hack = false if ie_hack.nil?
|
382
|
+
encoding ||= xml_decl.encoding
|
383
|
+
|
384
|
+
if encoding != 'UTF-8' && !output.kind_of?(Output)
|
385
|
+
output = Output.new( output, encoding )
|
386
|
+
end
|
387
|
+
formatter = if indent > -1
|
388
|
+
if transitive
|
389
|
+
require_relative "formatters/transitive"
|
390
|
+
REXML::Formatters::Transitive.new( indent, ie_hack )
|
391
|
+
else
|
392
|
+
REXML::Formatters::Pretty.new( indent, ie_hack )
|
393
|
+
end
|
394
|
+
else
|
395
|
+
REXML::Formatters::Default.new( ie_hack )
|
396
|
+
end
|
397
|
+
formatter.write( self, output )
|
398
|
+
end
|
399
|
+
|
400
|
+
|
401
|
+
def Document::parse_stream( source, listener )
|
402
|
+
Parsers::StreamParser.new( source, listener ).parse
|
403
|
+
end
|
404
|
+
|
405
|
+
# Set the entity expansion limit. By default the limit is set to 10000.
|
406
|
+
#
|
407
|
+
# Deprecated. Use REXML::Security.entity_expansion_limit= instead.
|
408
|
+
def Document::entity_expansion_limit=( val )
|
409
|
+
Security.entity_expansion_limit = val
|
410
|
+
end
|
411
|
+
|
412
|
+
# Get the entity expansion limit. By default the limit is set to 10000.
|
413
|
+
#
|
414
|
+
# Deprecated. Use REXML::Security.entity_expansion_limit= instead.
|
415
|
+
def Document::entity_expansion_limit
|
416
|
+
return Security.entity_expansion_limit
|
417
|
+
end
|
418
|
+
|
419
|
+
# Set the entity expansion limit. By default the limit is set to 10240.
|
420
|
+
#
|
421
|
+
# Deprecated. Use REXML::Security.entity_expansion_text_limit= instead.
|
422
|
+
def Document::entity_expansion_text_limit=( val )
|
423
|
+
Security.entity_expansion_text_limit = val
|
424
|
+
end
|
425
|
+
|
426
|
+
# Get the entity expansion limit. By default the limit is set to 10240.
|
427
|
+
#
|
428
|
+
# Deprecated. Use REXML::Security.entity_expansion_text_limit instead.
|
429
|
+
def Document::entity_expansion_text_limit
|
430
|
+
return Security.entity_expansion_text_limit
|
431
|
+
end
|
432
|
+
|
433
|
+
attr_reader :entity_expansion_count
|
434
|
+
|
435
|
+
def record_entity_expansion
|
436
|
+
@entity_expansion_count += 1
|
437
|
+
if @entity_expansion_count > Security.entity_expansion_limit
|
438
|
+
raise "number of entity expansions exceeded, processing aborted."
|
439
|
+
end
|
440
|
+
end
|
441
|
+
|
442
|
+
def document
|
443
|
+
self
|
444
|
+
end
|
445
|
+
|
446
|
+
private
|
447
|
+
def build( source )
|
448
|
+
Parsers::TreeParser.new( source, self ).parse
|
449
|
+
end
|
450
|
+
end
|
451
|
+
end
|