logstash-output-scalyr 0.1.10.beta → 0.1.11.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +4 -0
- data/README.md +2 -2
- data/lib/logstash/outputs/scalyr.rb +94 -73
- data/lib/scalyr/common/client.rb +3 -1
- data/lib/scalyr/constants.rb +2 -0
- data/logstash-output-scalyr.gemspec +1 -1
- data/spec/logstash/outputs/scalyr_integration_spec.rb +119 -8
- data/spec/logstash/outputs/scalyr_spec.rb +9 -6
- 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,58 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
require_relative 'pretty'
|
3
|
+
|
4
|
+
module REXML
|
5
|
+
module Formatters
|
6
|
+
# The Transitive formatter writes an XML document that parses to an
|
7
|
+
# identical document as the source document. This means that no extra
|
8
|
+
# whitespace nodes are inserted, and whitespace within text nodes is
|
9
|
+
# preserved. Within these constraints, the document is pretty-printed,
|
10
|
+
# with whitespace inserted into the metadata to introduce formatting.
|
11
|
+
#
|
12
|
+
# Note that this is only useful if the original XML is not already
|
13
|
+
# formatted. Since this formatter does not alter whitespace nodes, the
|
14
|
+
# results of formatting already formatted XML will be odd.
|
15
|
+
class Transitive < Default
|
16
|
+
def initialize( indentation=2, ie_hack=false )
|
17
|
+
@indentation = indentation
|
18
|
+
@level = 0
|
19
|
+
@ie_hack = ie_hack
|
20
|
+
end
|
21
|
+
|
22
|
+
protected
|
23
|
+
def write_element( node, output )
|
24
|
+
output << "<#{node.expanded_name}"
|
25
|
+
|
26
|
+
node.attributes.each_attribute do |attr|
|
27
|
+
output << " "
|
28
|
+
attr.write( output )
|
29
|
+
end unless node.attributes.empty?
|
30
|
+
|
31
|
+
output << "\n"
|
32
|
+
output << ' '*@level
|
33
|
+
if node.children.empty?
|
34
|
+
output << " " if @ie_hack
|
35
|
+
output << "/"
|
36
|
+
else
|
37
|
+
output << ">"
|
38
|
+
# If compact and all children are text, and if the formatted output
|
39
|
+
# is less than the specified width, then try to print everything on
|
40
|
+
# one line
|
41
|
+
@level += @indentation
|
42
|
+
node.children.each { |child|
|
43
|
+
write( child, output )
|
44
|
+
}
|
45
|
+
@level -= @indentation
|
46
|
+
output << "</#{node.expanded_name}"
|
47
|
+
output << "\n"
|
48
|
+
output << ' '*@level
|
49
|
+
end
|
50
|
+
output << ">"
|
51
|
+
end
|
52
|
+
|
53
|
+
def write_text( node, output )
|
54
|
+
output << node.to_s()
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,447 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
module REXML
|
3
|
+
# If you add a method, keep in mind two things:
|
4
|
+
# (1) the first argument will always be a list of nodes from which to
|
5
|
+
# filter. In the case of context methods (such as position), the function
|
6
|
+
# should return an array with a value for each child in the array.
|
7
|
+
# (2) all method calls from XML will have "-" replaced with "_".
|
8
|
+
# Therefore, in XML, "local-name()" is identical (and actually becomes)
|
9
|
+
# "local_name()"
|
10
|
+
module Functions
|
11
|
+
@@available_functions = {}
|
12
|
+
@@context = nil
|
13
|
+
@@namespace_context = {}
|
14
|
+
@@variables = {}
|
15
|
+
|
16
|
+
INTERNAL_METHODS = [
|
17
|
+
:namespace_context,
|
18
|
+
:namespace_context=,
|
19
|
+
:variables,
|
20
|
+
:variables=,
|
21
|
+
:context=,
|
22
|
+
:get_namespace,
|
23
|
+
:send,
|
24
|
+
]
|
25
|
+
class << self
|
26
|
+
def singleton_method_added(name)
|
27
|
+
unless INTERNAL_METHODS.include?(name)
|
28
|
+
@@available_functions[name] = true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def Functions::namespace_context=(x) ; @@namespace_context=x ; end
|
34
|
+
def Functions::variables=(x) ; @@variables=x ; end
|
35
|
+
def Functions::namespace_context ; @@namespace_context ; end
|
36
|
+
def Functions::variables ; @@variables ; end
|
37
|
+
|
38
|
+
def Functions::context=(value); @@context = value; end
|
39
|
+
|
40
|
+
def Functions::text( )
|
41
|
+
if @@context[:node].node_type == :element
|
42
|
+
return @@context[:node].find_all{|n| n.node_type == :text}.collect{|n| n.value}
|
43
|
+
elsif @@context[:node].node_type == :text
|
44
|
+
return @@context[:node].value
|
45
|
+
else
|
46
|
+
return false
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns the last node of the given list of nodes.
|
51
|
+
def Functions::last( )
|
52
|
+
@@context[:size]
|
53
|
+
end
|
54
|
+
|
55
|
+
def Functions::position( )
|
56
|
+
@@context[:index]
|
57
|
+
end
|
58
|
+
|
59
|
+
# Returns the size of the given list of nodes.
|
60
|
+
def Functions::count( node_set )
|
61
|
+
node_set.size
|
62
|
+
end
|
63
|
+
|
64
|
+
# Since REXML is non-validating, this method is not implemented as it
|
65
|
+
# requires a DTD
|
66
|
+
def Functions::id( object )
|
67
|
+
end
|
68
|
+
|
69
|
+
def Functions::local_name(node_set=nil)
|
70
|
+
get_namespace(node_set) do |node|
|
71
|
+
return node.local_name
|
72
|
+
end
|
73
|
+
""
|
74
|
+
end
|
75
|
+
|
76
|
+
def Functions::namespace_uri( node_set=nil )
|
77
|
+
get_namespace( node_set ) {|node| node.namespace}
|
78
|
+
end
|
79
|
+
|
80
|
+
def Functions::name( node_set=nil )
|
81
|
+
get_namespace( node_set ) do |node|
|
82
|
+
node.expanded_name
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Helper method.
|
87
|
+
def Functions::get_namespace( node_set = nil )
|
88
|
+
if node_set == nil
|
89
|
+
yield @@context[:node] if @@context[:node].respond_to?(:namespace)
|
90
|
+
else
|
91
|
+
if node_set.respond_to? :each
|
92
|
+
result = []
|
93
|
+
node_set.each do |node|
|
94
|
+
result << yield(node) if node.respond_to?(:namespace)
|
95
|
+
end
|
96
|
+
result
|
97
|
+
elsif node_set.respond_to? :namespace
|
98
|
+
yield node_set
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# A node-set is converted to a string by returning the string-value of the
|
104
|
+
# node in the node-set that is first in document order. If the node-set is
|
105
|
+
# empty, an empty string is returned.
|
106
|
+
#
|
107
|
+
# A number is converted to a string as follows
|
108
|
+
#
|
109
|
+
# NaN is converted to the string NaN
|
110
|
+
#
|
111
|
+
# positive zero is converted to the string 0
|
112
|
+
#
|
113
|
+
# negative zero is converted to the string 0
|
114
|
+
#
|
115
|
+
# positive infinity is converted to the string Infinity
|
116
|
+
#
|
117
|
+
# negative infinity is converted to the string -Infinity
|
118
|
+
#
|
119
|
+
# if the number is an integer, the number is represented in decimal form
|
120
|
+
# as a Number with no decimal point and no leading zeros, preceded by a
|
121
|
+
# minus sign (-) if the number is negative
|
122
|
+
#
|
123
|
+
# otherwise, the number is represented in decimal form as a Number
|
124
|
+
# including a decimal point with at least one digit before the decimal
|
125
|
+
# point and at least one digit after the decimal point, preceded by a
|
126
|
+
# minus sign (-) if the number is negative; there must be no leading zeros
|
127
|
+
# before the decimal point apart possibly from the one required digit
|
128
|
+
# immediately before the decimal point; beyond the one required digit
|
129
|
+
# after the decimal point there must be as many, but only as many, more
|
130
|
+
# digits as are needed to uniquely distinguish the number from all other
|
131
|
+
# IEEE 754 numeric values.
|
132
|
+
#
|
133
|
+
# The boolean false value is converted to the string false. The boolean
|
134
|
+
# true value is converted to the string true.
|
135
|
+
#
|
136
|
+
# An object of a type other than the four basic types is converted to a
|
137
|
+
# string in a way that is dependent on that type.
|
138
|
+
def Functions::string( object=@@context[:node] )
|
139
|
+
if object.respond_to?(:node_type)
|
140
|
+
case object.node_type
|
141
|
+
when :attribute
|
142
|
+
object.value
|
143
|
+
when :element
|
144
|
+
string_value(object)
|
145
|
+
when :document
|
146
|
+
string_value(object.root)
|
147
|
+
when :processing_instruction
|
148
|
+
object.content
|
149
|
+
else
|
150
|
+
object.to_s
|
151
|
+
end
|
152
|
+
else
|
153
|
+
case object
|
154
|
+
when Array
|
155
|
+
string(object[0])
|
156
|
+
when Float
|
157
|
+
if object.nan?
|
158
|
+
"NaN"
|
159
|
+
else
|
160
|
+
integer = object.to_i
|
161
|
+
if object == integer
|
162
|
+
"%d" % integer
|
163
|
+
else
|
164
|
+
object.to_s
|
165
|
+
end
|
166
|
+
end
|
167
|
+
else
|
168
|
+
object.to_s
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
# A node-set is converted to a string by
|
174
|
+
# returning the concatenation of the string-value
|
175
|
+
# of each of the children of the node in the
|
176
|
+
# node-set that is first in document order.
|
177
|
+
# If the node-set is empty, an empty string is returned.
|
178
|
+
def Functions::string_value( o )
|
179
|
+
rv = ""
|
180
|
+
o.children.each { |e|
|
181
|
+
if e.node_type == :text
|
182
|
+
rv << e.to_s
|
183
|
+
elsif e.node_type == :element
|
184
|
+
rv << string_value( e )
|
185
|
+
end
|
186
|
+
}
|
187
|
+
rv
|
188
|
+
end
|
189
|
+
|
190
|
+
def Functions::concat( *objects )
|
191
|
+
concatenated = ""
|
192
|
+
objects.each do |object|
|
193
|
+
concatenated << string(object)
|
194
|
+
end
|
195
|
+
concatenated
|
196
|
+
end
|
197
|
+
|
198
|
+
# Fixed by Mike Stok
|
199
|
+
def Functions::starts_with( string, test )
|
200
|
+
string(string).index(string(test)) == 0
|
201
|
+
end
|
202
|
+
|
203
|
+
# Fixed by Mike Stok
|
204
|
+
def Functions::contains( string, test )
|
205
|
+
string(string).include?(string(test))
|
206
|
+
end
|
207
|
+
|
208
|
+
# Kouhei fixed this
|
209
|
+
def Functions::substring_before( string, test )
|
210
|
+
ruby_string = string(string)
|
211
|
+
ruby_index = ruby_string.index(string(test))
|
212
|
+
if ruby_index.nil?
|
213
|
+
""
|
214
|
+
else
|
215
|
+
ruby_string[ 0...ruby_index ]
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
# Kouhei fixed this too
|
220
|
+
def Functions::substring_after( string, test )
|
221
|
+
ruby_string = string(string)
|
222
|
+
return $1 if ruby_string =~ /#{test}(.*)/
|
223
|
+
""
|
224
|
+
end
|
225
|
+
|
226
|
+
# Take equal portions of Mike Stok and Sean Russell; mix
|
227
|
+
# vigorously, and pour into a tall, chilled glass. Serves 10,000.
|
228
|
+
def Functions::substring( string, start, length=nil )
|
229
|
+
ruby_string = string(string)
|
230
|
+
ruby_length = if length.nil?
|
231
|
+
ruby_string.length.to_f
|
232
|
+
else
|
233
|
+
number(length)
|
234
|
+
end
|
235
|
+
ruby_start = number(start)
|
236
|
+
|
237
|
+
# Handle the special cases
|
238
|
+
return '' if (
|
239
|
+
ruby_length.nan? or
|
240
|
+
ruby_start.nan? or
|
241
|
+
ruby_start.infinite?
|
242
|
+
)
|
243
|
+
|
244
|
+
infinite_length = ruby_length.infinite? == 1
|
245
|
+
ruby_length = ruby_string.length if infinite_length
|
246
|
+
|
247
|
+
# Now, get the bounds. The XPath bounds are 1..length; the ruby bounds
|
248
|
+
# are 0..length. Therefore, we have to offset the bounds by one.
|
249
|
+
ruby_start = round(ruby_start) - 1
|
250
|
+
ruby_length = round(ruby_length)
|
251
|
+
|
252
|
+
if ruby_start < 0
|
253
|
+
ruby_length += ruby_start unless infinite_length
|
254
|
+
ruby_start = 0
|
255
|
+
end
|
256
|
+
return '' if ruby_length <= 0
|
257
|
+
ruby_string[ruby_start,ruby_length]
|
258
|
+
end
|
259
|
+
|
260
|
+
# UNTESTED
|
261
|
+
def Functions::string_length( string )
|
262
|
+
string(string).length
|
263
|
+
end
|
264
|
+
|
265
|
+
# UNTESTED
|
266
|
+
def Functions::normalize_space( string=nil )
|
267
|
+
string = string(@@context[:node]) if string.nil?
|
268
|
+
if string.kind_of? Array
|
269
|
+
string.collect{|x| string.to_s.strip.gsub(/\s+/um, ' ') if string}
|
270
|
+
else
|
271
|
+
string.to_s.strip.gsub(/\s+/um, ' ')
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
# This is entirely Mike Stok's beast
|
276
|
+
def Functions::translate( string, tr1, tr2 )
|
277
|
+
from = string(tr1)
|
278
|
+
to = string(tr2)
|
279
|
+
|
280
|
+
# the map is our translation table.
|
281
|
+
#
|
282
|
+
# if a character occurs more than once in the
|
283
|
+
# from string then we ignore the second &
|
284
|
+
# subsequent mappings
|
285
|
+
#
|
286
|
+
# if a character maps to nil then we delete it
|
287
|
+
# in the output. This happens if the from
|
288
|
+
# string is longer than the to string
|
289
|
+
#
|
290
|
+
# there's nothing about - or ^ being special in
|
291
|
+
# http://www.w3.org/TR/xpath#function-translate
|
292
|
+
# so we don't build ranges or negated classes
|
293
|
+
|
294
|
+
map = Hash.new
|
295
|
+
0.upto(from.length - 1) { |pos|
|
296
|
+
from_char = from[pos]
|
297
|
+
unless map.has_key? from_char
|
298
|
+
map[from_char] =
|
299
|
+
if pos < to.length
|
300
|
+
to[pos]
|
301
|
+
else
|
302
|
+
nil
|
303
|
+
end
|
304
|
+
end
|
305
|
+
}
|
306
|
+
|
307
|
+
if ''.respond_to? :chars
|
308
|
+
string(string).chars.collect { |c|
|
309
|
+
if map.has_key? c then map[c] else c end
|
310
|
+
}.compact.join
|
311
|
+
else
|
312
|
+
string(string).unpack('U*').collect { |c|
|
313
|
+
if map.has_key? c then map[c] else c end
|
314
|
+
}.compact.pack('U*')
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
def Functions::boolean(object=@@context[:node])
|
319
|
+
case object
|
320
|
+
when true, false
|
321
|
+
object
|
322
|
+
when Float
|
323
|
+
return false if object.zero?
|
324
|
+
return false if object.nan?
|
325
|
+
true
|
326
|
+
when Numeric
|
327
|
+
not object.zero?
|
328
|
+
when String
|
329
|
+
not object.empty?
|
330
|
+
when Array
|
331
|
+
not object.empty?
|
332
|
+
else
|
333
|
+
object ? true : false
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
337
|
+
# UNTESTED
|
338
|
+
def Functions::not( object )
|
339
|
+
not boolean( object )
|
340
|
+
end
|
341
|
+
|
342
|
+
# UNTESTED
|
343
|
+
def Functions::true( )
|
344
|
+
true
|
345
|
+
end
|
346
|
+
|
347
|
+
# UNTESTED
|
348
|
+
def Functions::false( )
|
349
|
+
false
|
350
|
+
end
|
351
|
+
|
352
|
+
# UNTESTED
|
353
|
+
def Functions::lang( language )
|
354
|
+
lang = false
|
355
|
+
node = @@context[:node]
|
356
|
+
attr = nil
|
357
|
+
until node.nil?
|
358
|
+
if node.node_type == :element
|
359
|
+
attr = node.attributes["xml:lang"]
|
360
|
+
unless attr.nil?
|
361
|
+
lang = compare_language(string(language), attr)
|
362
|
+
break
|
363
|
+
else
|
364
|
+
end
|
365
|
+
end
|
366
|
+
node = node.parent
|
367
|
+
end
|
368
|
+
lang
|
369
|
+
end
|
370
|
+
|
371
|
+
def Functions::compare_language lang1, lang2
|
372
|
+
lang2.downcase.index(lang1.downcase) == 0
|
373
|
+
end
|
374
|
+
|
375
|
+
# a string that consists of optional whitespace followed by an optional
|
376
|
+
# minus sign followed by a Number followed by whitespace is converted to
|
377
|
+
# the IEEE 754 number that is nearest (according to the IEEE 754
|
378
|
+
# round-to-nearest rule) to the mathematical value represented by the
|
379
|
+
# string; any other string is converted to NaN
|
380
|
+
#
|
381
|
+
# boolean true is converted to 1; boolean false is converted to 0
|
382
|
+
#
|
383
|
+
# a node-set is first converted to a string as if by a call to the string
|
384
|
+
# function and then converted in the same way as a string argument
|
385
|
+
#
|
386
|
+
# an object of a type other than the four basic types is converted to a
|
387
|
+
# number in a way that is dependent on that type
|
388
|
+
def Functions::number(object=@@context[:node])
|
389
|
+
case object
|
390
|
+
when true
|
391
|
+
Float(1)
|
392
|
+
when false
|
393
|
+
Float(0)
|
394
|
+
when Array
|
395
|
+
number(string(object))
|
396
|
+
when Numeric
|
397
|
+
object.to_f
|
398
|
+
else
|
399
|
+
str = string(object)
|
400
|
+
case str.strip
|
401
|
+
when /\A\s*(-?(?:\d+(?:\.\d*)?|\.\d+))\s*\z/
|
402
|
+
$1.to_f
|
403
|
+
else
|
404
|
+
Float::NAN
|
405
|
+
end
|
406
|
+
end
|
407
|
+
end
|
408
|
+
|
409
|
+
def Functions::sum( nodes )
|
410
|
+
nodes = [nodes] unless nodes.kind_of? Array
|
411
|
+
nodes.inject(0) { |r,n| r + number(string(n)) }
|
412
|
+
end
|
413
|
+
|
414
|
+
def Functions::floor( number )
|
415
|
+
number(number).floor
|
416
|
+
end
|
417
|
+
|
418
|
+
def Functions::ceiling( number )
|
419
|
+
number(number).ceil
|
420
|
+
end
|
421
|
+
|
422
|
+
def Functions::round( number )
|
423
|
+
number = number(number)
|
424
|
+
begin
|
425
|
+
neg = number.negative?
|
426
|
+
number = number.abs.round
|
427
|
+
neg ? -number : number
|
428
|
+
rescue FloatDomainError
|
429
|
+
number
|
430
|
+
end
|
431
|
+
end
|
432
|
+
|
433
|
+
def Functions::processing_instruction( node )
|
434
|
+
node.node_type == :processing_instruction
|
435
|
+
end
|
436
|
+
|
437
|
+
def Functions::send(name, *args)
|
438
|
+
if @@available_functions[name.to_sym]
|
439
|
+
super
|
440
|
+
else
|
441
|
+
# TODO: Maybe, this is not XPath spec behavior.
|
442
|
+
# This behavior must be reconsidered.
|
443
|
+
XPath.match(@@context[:node], name.to_s)
|
444
|
+
end
|
445
|
+
end
|
446
|
+
end
|
447
|
+
end
|