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.
Files changed (317) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/Gemfile +4 -0
  4. data/README.md +2 -2
  5. data/lib/logstash/outputs/scalyr.rb +94 -73
  6. data/lib/scalyr/common/client.rb +3 -1
  7. data/lib/scalyr/constants.rb +2 -0
  8. data/logstash-output-scalyr.gemspec +1 -1
  9. data/spec/logstash/outputs/scalyr_integration_spec.rb +119 -8
  10. data/spec/logstash/outputs/scalyr_spec.rb +9 -6
  11. data/vendor/bundle/jruby/2.5.0/cache/addressable-2.7.0.gem +0 -0
  12. data/vendor/bundle/jruby/2.5.0/cache/crack-0.4.5.gem +0 -0
  13. data/vendor/bundle/jruby/2.5.0/cache/hashdiff-1.0.1.gem +0 -0
  14. data/vendor/bundle/jruby/2.5.0/cache/public_suffix-4.0.6.gem +0 -0
  15. data/vendor/bundle/jruby/2.5.0/cache/rexml-3.2.5.gem +0 -0
  16. data/vendor/bundle/jruby/2.5.0/cache/webmock-3.13.0.gem +0 -0
  17. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/CHANGELOG.md +235 -0
  18. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/Gemfile +32 -0
  19. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/LICENSE.txt +202 -0
  20. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/README.md +121 -0
  21. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/Rakefile +34 -0
  22. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/data/unicode.data +0 -0
  23. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable.rb +4 -0
  24. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/idna.rb +27 -0
  25. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/idna/native.rb +61 -0
  26. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/idna/pure.rb +676 -0
  27. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/template.rb +1045 -0
  28. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/uri.rb +2529 -0
  29. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/version.rb +32 -0
  30. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/idna_spec.rb +300 -0
  31. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/net_http_compat_spec.rb +30 -0
  32. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/rack_mount_compat_spec.rb +106 -0
  33. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/security_spec.rb +59 -0
  34. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/template_spec.rb +1451 -0
  35. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/uri_spec.rb +6603 -0
  36. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/spec_helper.rb +24 -0
  37. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/clobber.rake +4 -0
  38. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/gem.rake +93 -0
  39. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/git.rake +47 -0
  40. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/metrics.rake +24 -0
  41. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/rspec.rake +23 -0
  42. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/yard.rake +29 -0
  43. data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack.rb +7 -0
  44. data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/json.rb +98 -0
  45. data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/util.rb +17 -0
  46. data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/version.rb +3 -0
  47. data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/xml.rb +238 -0
  48. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/Gemfile +8 -0
  49. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/LICENSE +19 -0
  50. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/README.md +276 -0
  51. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/Rakefile +18 -0
  52. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/changelog.md +100 -0
  53. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/hashdiff.gemspec +39 -0
  54. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff.rb +10 -0
  55. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/compare_hashes.rb +69 -0
  56. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/diff.rb +177 -0
  57. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/lcs.rb +66 -0
  58. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/lcs_compare_arrays.rb +32 -0
  59. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/linear_compare_array.rb +159 -0
  60. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/patch.rb +88 -0
  61. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/util.rb +155 -0
  62. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/version.rb +5 -0
  63. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/best_diff_spec.rb +75 -0
  64. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/diff_array_spec.rb +60 -0
  65. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/diff_spec.rb +360 -0
  66. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/lcs_spec.rb +76 -0
  67. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/linear_compare_array_spec.rb +50 -0
  68. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/patch_spec.rb +185 -0
  69. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/readme_spec.rb +15 -0
  70. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/util_spec.rb +116 -0
  71. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/spec_helper.rb +15 -0
  72. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/2.0-Upgrade.md +52 -0
  73. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/CHANGELOG.md +406 -0
  74. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/Gemfile +15 -0
  75. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/LICENSE.txt +22 -0
  76. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/README.md +207 -0
  77. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/Rakefile +51 -0
  78. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/SECURITY.md +104 -0
  79. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/bin/console +15 -0
  80. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/codecov.yml +12 -0
  81. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/data/list.txt +13380 -0
  82. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix.rb +179 -0
  83. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/domain.rb +235 -0
  84. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/errors.rb +41 -0
  85. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/list.rb +247 -0
  86. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/rule.rb +350 -0
  87. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/version.rb +13 -0
  88. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/public_suffix.gemspec +29 -0
  89. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/acceptance_test.rb +131 -0
  90. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb +66 -0
  91. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find_all.rb +102 -0
  92. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_names.rb +91 -0
  93. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_select.rb +26 -0
  94. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_select_incremental.rb +25 -0
  95. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_valid.rb +101 -0
  96. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/domain_profiler.rb +12 -0
  97. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/find_profiler.rb +12 -0
  98. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/find_profiler_jp.rb +12 -0
  99. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/initialization_profiler.rb +11 -0
  100. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/list_profsize.rb +11 -0
  101. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/object_binsize.rb +57 -0
  102. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/psl_test.rb +52 -0
  103. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/test_helper.rb +18 -0
  104. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/tests.txt +98 -0
  105. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/domain_test.rb +106 -0
  106. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/errors_test.rb +25 -0
  107. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/list_test.rb +241 -0
  108. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/public_suffix_test.rb +188 -0
  109. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/rule_test.rb +222 -0
  110. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/LICENSE.txt +22 -0
  111. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/NEWS.md +178 -0
  112. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/README.md +48 -0
  113. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/context.rdoc +143 -0
  114. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/child.rdoc +87 -0
  115. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/document.rdoc +276 -0
  116. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/element.rdoc +602 -0
  117. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/node.rdoc +97 -0
  118. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/parent.rdoc +267 -0
  119. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/child_toc.rdoc +12 -0
  120. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/document_toc.rdoc +30 -0
  121. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/element_toc.rdoc +55 -0
  122. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/master_toc.rdoc +135 -0
  123. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/node_toc.rdoc +16 -0
  124. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/parent_toc.rdoc +25 -0
  125. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml.rb +3 -0
  126. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/attlistdecl.rb +63 -0
  127. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/attribute.rb +205 -0
  128. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/cdata.rb +68 -0
  129. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/child.rb +97 -0
  130. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/comment.rb +80 -0
  131. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/doctype.rb +311 -0
  132. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/document.rb +451 -0
  133. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/attlistdecl.rb +11 -0
  134. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/dtd.rb +47 -0
  135. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/elementdecl.rb +18 -0
  136. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/entitydecl.rb +57 -0
  137. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/notationdecl.rb +40 -0
  138. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/element.rb +2599 -0
  139. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/encoding.rb +51 -0
  140. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/entity.rb +171 -0
  141. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/formatters/default.rb +116 -0
  142. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/formatters/pretty.rb +142 -0
  143. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/formatters/transitive.rb +58 -0
  144. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/functions.rb +447 -0
  145. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/instruction.rb +79 -0
  146. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/light/node.rb +188 -0
  147. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/namespace.rb +59 -0
  148. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/node.rb +76 -0
  149. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/output.rb +30 -0
  150. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parent.rb +166 -0
  151. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parseexception.rb +52 -0
  152. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb +694 -0
  153. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/lightparser.rb +59 -0
  154. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/pullparser.rb +197 -0
  155. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/sax2parser.rb +273 -0
  156. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/streamparser.rb +61 -0
  157. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/treeparser.rb +101 -0
  158. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/ultralightparser.rb +57 -0
  159. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/xpathparser.rb +689 -0
  160. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/quickpath.rb +266 -0
  161. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/rexml.rb +37 -0
  162. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/sax2listener.rb +98 -0
  163. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/security.rb +28 -0
  164. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/source.rb +298 -0
  165. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/streamlistener.rb +93 -0
  166. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/text.rb +424 -0
  167. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/undefinednamespaceexception.rb +9 -0
  168. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/validation/relaxng.rb +539 -0
  169. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/validation/validation.rb +144 -0
  170. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/validation/validationexception.rb +10 -0
  171. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xmldecl.rb +130 -0
  172. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xmltokens.rb +85 -0
  173. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xpath.rb +81 -0
  174. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xpath_parser.rb +974 -0
  175. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/CHANGELOG.md +1894 -0
  176. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/Gemfile +9 -0
  177. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/LICENSE +20 -0
  178. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/README.md +1176 -0
  179. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/Rakefile +38 -0
  180. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock.rb +59 -0
  181. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/api.rb +109 -0
  182. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/assertion_failure.rb +11 -0
  183. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/callback_registry.rb +35 -0
  184. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/config.rb +18 -0
  185. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/cucumber.rb +10 -0
  186. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/deprecation.rb +9 -0
  187. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/errors.rb +17 -0
  188. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/async_http_client_adapter.rb +216 -0
  189. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/curb_adapter.rb +351 -0
  190. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +231 -0
  191. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/excon_adapter.rb +165 -0
  192. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_lib_adapter.rb +7 -0
  193. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_lib_adapter_registry.rb +19 -0
  194. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/client.rb +17 -0
  195. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/request.rb +16 -0
  196. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/response.rb +64 -0
  197. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/streamer.rb +29 -0
  198. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/webmock.rb +68 -0
  199. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb_adapter.rb +37 -0
  200. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/httpclient_adapter.rb +259 -0
  201. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/manticore_adapter.rb +145 -0
  202. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/net_http.rb +385 -0
  203. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/net_http_response.rb +34 -0
  204. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/patron_adapter.rb +130 -0
  205. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb +174 -0
  206. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/any_arg_matcher.rb +13 -0
  207. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/hash_argument_matcher.rb +21 -0
  208. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/hash_excluding_matcher.rb +15 -0
  209. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/hash_including_matcher.rb +17 -0
  210. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/minitest.rb +41 -0
  211. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rack_response.rb +69 -0
  212. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_body_diff.rb +64 -0
  213. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_execution_verifier.rb +77 -0
  214. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_pattern.rb +405 -0
  215. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_registry.rb +35 -0
  216. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_signature.rb +54 -0
  217. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_signature_snippet.rb +61 -0
  218. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_stub.rb +100 -0
  219. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/response.rb +159 -0
  220. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/responses_sequence.rb +40 -0
  221. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec.rb +42 -0
  222. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec/matchers.rb +27 -0
  223. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec/matchers/request_pattern_matcher.rb +78 -0
  224. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec/matchers/webmock_matcher.rb +67 -0
  225. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/stub_registry.rb +82 -0
  226. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/stub_request_snippet.rb +38 -0
  227. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/test_unit.rb +20 -0
  228. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/hash_counter.rb +39 -0
  229. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/hash_keys_stringifier.rb +25 -0
  230. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/hash_validator.rb +17 -0
  231. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/headers.rb +64 -0
  232. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/json.rb +67 -0
  233. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/query_mapper.rb +281 -0
  234. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/uri.rb +111 -0
  235. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/values_stringifier.rb +20 -0
  236. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/version_checker.rb +111 -0
  237. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/version.rb +3 -0
  238. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/webmock.rb +163 -0
  239. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/minitest/test_helper.rb +34 -0
  240. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/minitest/test_webmock.rb +9 -0
  241. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/minitest/webmock_spec.rb +60 -0
  242. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/async_http_client/async_http_client_spec.rb +375 -0
  243. 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
  244. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/curb/curb_spec.rb +499 -0
  245. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/curb/curb_spec_helper.rb +147 -0
  246. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/em_http_request/em_http_request_spec.rb +462 -0
  247. 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
  248. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/excon/excon_spec.rb +77 -0
  249. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/excon/excon_spec_helper.rb +52 -0
  250. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/http_rb/http_rb_spec.rb +93 -0
  251. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/http_rb/http_rb_spec_helper.rb +54 -0
  252. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/httpclient/httpclient_spec.rb +217 -0
  253. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/httpclient/httpclient_spec_helper.rb +57 -0
  254. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec.rb +107 -0
  255. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb +35 -0
  256. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/net_http_shared.rb +153 -0
  257. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/net_http_spec.rb +369 -0
  258. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/net_http_spec_helper.rb +64 -0
  259. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/real_net_http_spec.rb +20 -0
  260. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/patron/patron_spec.rb +125 -0
  261. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/patron/patron_spec_helper.rb +54 -0
  262. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/allowing_and_disabling_net_connect.rb +313 -0
  263. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/callbacks.rb +148 -0
  264. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/complex_cross_concern_behaviors.rb +36 -0
  265. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/enabling_and_disabling_webmock.rb +95 -0
  266. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/precedence_of_stubs.rb +15 -0
  267. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/request_expectations.rb +930 -0
  268. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/returning_declared_responses.rb +409 -0
  269. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/stubbing_requests.rb +678 -0
  270. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +135 -0
  271. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb +60 -0
  272. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/webmock_shared.rb +41 -0
  273. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/fixtures/test.txt +1 -0
  274. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/quality_spec.rb +84 -0
  275. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/spec_helper.rb +48 -0
  276. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/example_curl_output.txt +22 -0
  277. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/failures.rb +9 -0
  278. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/my_rack_app.rb +53 -0
  279. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/network_connection.rb +19 -0
  280. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/webmock_server.rb +70 -0
  281. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/api_spec.rb +175 -0
  282. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/errors_spec.rb +129 -0
  283. 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
  284. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/http_lib_adapters/http_lib_adapter_spec.rb +12 -0
  285. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/matchers/hash_excluding_matcher_spec.rb +61 -0
  286. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/matchers/hash_including_matcher_spec.rb +87 -0
  287. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/rack_response_spec.rb +112 -0
  288. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_body_diff_spec.rb +90 -0
  289. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_execution_verifier_spec.rb +208 -0
  290. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_pattern_spec.rb +736 -0
  291. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_registry_spec.rb +95 -0
  292. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_signature_snippet_spec.rb +89 -0
  293. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_signature_spec.rb +155 -0
  294. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_stub_spec.rb +199 -0
  295. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/response_spec.rb +286 -0
  296. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/stub_registry_spec.rb +103 -0
  297. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/stub_request_snippet_spec.rb +115 -0
  298. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/hash_counter_spec.rb +39 -0
  299. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/hash_keys_stringifier_spec.rb +27 -0
  300. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/headers_spec.rb +28 -0
  301. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/json_spec.rb +33 -0
  302. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/query_mapper_spec.rb +157 -0
  303. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/uri_spec.rb +371 -0
  304. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/version_checker_spec.rb +65 -0
  305. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb +60 -0
  306. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/http_request.rb +24 -0
  307. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/shared_test.rb +108 -0
  308. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/test_helper.rb +23 -0
  309. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/test_webmock.rb +12 -0
  310. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/webmock.gemspec +54 -0
  311. data/vendor/bundle/jruby/2.5.0/specifications/addressable-2.7.0.gemspec +39 -0
  312. data/vendor/bundle/jruby/2.5.0/specifications/crack-0.4.5.gemspec +32 -0
  313. data/vendor/bundle/jruby/2.5.0/specifications/hashdiff-1.0.1.gemspec +46 -0
  314. data/vendor/bundle/jruby/2.5.0/specifications/public_suffix-4.0.6.gemspec +24 -0
  315. data/vendor/bundle/jruby/2.5.0/specifications/rexml-3.2.5.gemspec +42 -0
  316. data/vendor/bundle/jruby/2.5.0/specifications/webmock-3.13.0.gemspec +85 -0
  317. metadata +309 -2
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: false
2
+ require_relative "baseparser"
3
+
4
+ module REXML
5
+ module Parsers
6
+ class StreamParser
7
+ def initialize source, listener
8
+ @listener = listener
9
+ @parser = BaseParser.new( source )
10
+ @tag_stack = []
11
+ end
12
+
13
+ def add_listener( listener )
14
+ @parser.add_listener( listener )
15
+ end
16
+
17
+ def parse
18
+ # entity string
19
+ while true
20
+ event = @parser.pull
21
+ case event[0]
22
+ when :end_document
23
+ unless @tag_stack.empty?
24
+ tag_path = "/" + @tag_stack.join("/")
25
+ raise ParseException.new("Missing end tag for '#{tag_path}'",
26
+ @parser.source)
27
+ end
28
+ return
29
+ when :start_element
30
+ @tag_stack << event[1]
31
+ attrs = event[2].each do |n, v|
32
+ event[2][n] = @parser.unnormalize( v )
33
+ end
34
+ @listener.tag_start( event[1], attrs )
35
+ when :end_element
36
+ @listener.tag_end( event[1] )
37
+ @tag_stack.pop
38
+ when :text
39
+ normalized = @parser.unnormalize( event[1] )
40
+ @listener.text( normalized )
41
+ when :processing_instruction
42
+ @listener.instruction( *event[1,2] )
43
+ when :start_doctype
44
+ @listener.doctype( *event[1..-1] )
45
+ when :end_doctype
46
+ # FIXME: remove this condition for milestone:3.2
47
+ @listener.doctype_end if @listener.respond_to? :doctype_end
48
+ when :comment, :attlistdecl, :cdata, :xmldecl, :elementdecl
49
+ @listener.send( event[0].to_s, *event[1..-1] )
50
+ when :entitydecl, :notationdecl
51
+ @listener.send( event[0].to_s, event[1..-1] )
52
+ when :externalentity
53
+ entity_reference = event[1]
54
+ content = entity_reference.gsub(/\A%|;\z/, "")
55
+ @listener.entity(content)
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,101 @@
1
+ # frozen_string_literal: false
2
+ require_relative '../validation/validationexception'
3
+ require_relative '../undefinednamespaceexception'
4
+
5
+ module REXML
6
+ module Parsers
7
+ class TreeParser
8
+ def initialize( source, build_context = Document.new )
9
+ @build_context = build_context
10
+ @parser = Parsers::BaseParser.new( source )
11
+ end
12
+
13
+ def add_listener( listener )
14
+ @parser.add_listener( listener )
15
+ end
16
+
17
+ def parse
18
+ tag_stack = []
19
+ in_doctype = false
20
+ entities = nil
21
+ begin
22
+ while true
23
+ event = @parser.pull
24
+ #STDERR.puts "TREEPARSER GOT #{event.inspect}"
25
+ case event[0]
26
+ when :end_document
27
+ unless tag_stack.empty?
28
+ raise ParseException.new("No close tag for #{@build_context.xpath}",
29
+ @parser.source, @parser)
30
+ end
31
+ return
32
+ when :start_element
33
+ tag_stack.push(event[1])
34
+ el = @build_context = @build_context.add_element( event[1] )
35
+ event[2].each do |key, value|
36
+ el.attributes[key]=Attribute.new(key,value,self)
37
+ end
38
+ when :end_element
39
+ tag_stack.pop
40
+ @build_context = @build_context.parent
41
+ when :text
42
+ if not in_doctype
43
+ if @build_context[-1].instance_of? Text
44
+ @build_context[-1] << event[1]
45
+ else
46
+ @build_context.add(
47
+ Text.new(event[1], @build_context.whitespace, nil, true)
48
+ ) unless (
49
+ @build_context.ignore_whitespace_nodes and
50
+ event[1].strip.size==0
51
+ )
52
+ end
53
+ end
54
+ when :comment
55
+ c = Comment.new( event[1] )
56
+ @build_context.add( c )
57
+ when :cdata
58
+ c = CData.new( event[1] )
59
+ @build_context.add( c )
60
+ when :processing_instruction
61
+ @build_context.add( Instruction.new( event[1], event[2] ) )
62
+ when :end_doctype
63
+ in_doctype = false
64
+ entities.each { |k,v| entities[k] = @build_context.entities[k].value }
65
+ @build_context = @build_context.parent
66
+ when :start_doctype
67
+ doctype = DocType.new( event[1..-1], @build_context )
68
+ @build_context = doctype
69
+ entities = {}
70
+ in_doctype = true
71
+ when :attlistdecl
72
+ n = AttlistDecl.new( event[1..-1] )
73
+ @build_context.add( n )
74
+ when :externalentity
75
+ n = ExternalEntity.new( event[1] )
76
+ @build_context.add( n )
77
+ when :elementdecl
78
+ n = ElementDecl.new( event[1] )
79
+ @build_context.add(n)
80
+ when :entitydecl
81
+ entities[ event[1] ] = event[2] unless event[2] =~ /PUBLIC|SYSTEM/
82
+ @build_context.add(Entity.new(event))
83
+ when :notationdecl
84
+ n = NotationDecl.new( *event[1..-1] )
85
+ @build_context.add( n )
86
+ when :xmldecl
87
+ x = XMLDecl.new( event[1], event[2], event[3] )
88
+ @build_context.add( x )
89
+ end
90
+ end
91
+ rescue REXML::Validation::ValidationException
92
+ raise
93
+ rescue REXML::ParseException
94
+ raise
95
+ rescue
96
+ raise ParseException.new( $!.message, @parser.source, @parser, $! )
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: false
2
+ require_relative 'streamparser'
3
+ require_relative 'baseparser'
4
+
5
+ module REXML
6
+ module Parsers
7
+ class UltraLightParser
8
+ def initialize stream
9
+ @stream = stream
10
+ @parser = REXML::Parsers::BaseParser.new( stream )
11
+ end
12
+
13
+ def add_listener( listener )
14
+ @parser.add_listener( listener )
15
+ end
16
+
17
+ def rewind
18
+ @stream.rewind
19
+ @parser.stream = @stream
20
+ end
21
+
22
+ def parse
23
+ root = context = []
24
+ while true
25
+ event = @parser.pull
26
+ case event[0]
27
+ when :end_document
28
+ break
29
+ when :end_doctype
30
+ context = context[1]
31
+ when :start_element, :start_doctype
32
+ context << event
33
+ event[1,0] = [context]
34
+ context = event
35
+ when :end_element
36
+ context = context[1]
37
+ else
38
+ context << event
39
+ end
40
+ end
41
+ root
42
+ end
43
+ end
44
+
45
+ # An element is an array. The array contains:
46
+ # 0 The parent element
47
+ # 1 The tag name
48
+ # 2 A hash of attributes
49
+ # 3..-1 The child elements
50
+ # An element is an array of size > 3
51
+ # Text is a String
52
+ # PIs are [ :processing_instruction, target, data ]
53
+ # Comments are [ :comment, data ]
54
+ # DocTypes are DocType structs
55
+ # The root is an array with XMLDecls, Text, DocType, Array, Text
56
+ end
57
+ end
@@ -0,0 +1,689 @@
1
+ # frozen_string_literal: false
2
+ require_relative '../namespace'
3
+ require_relative '../xmltokens'
4
+
5
+ module REXML
6
+ module Parsers
7
+ # You don't want to use this class. Really. Use XPath, which is a wrapper
8
+ # for this class. Believe me. You don't want to poke around in here.
9
+ # There is strange, dark magic at work in this code. Beware. Go back! Go
10
+ # back while you still can!
11
+ class XPathParser
12
+ include XMLTokens
13
+ LITERAL = /^'([^']*)'|^"([^"]*)"/u
14
+
15
+ def namespaces=( namespaces )
16
+ Functions::namespace_context = namespaces
17
+ @namespaces = namespaces
18
+ end
19
+
20
+ def parse path
21
+ path = path.dup
22
+ path.gsub!(/([\(\[])\s+/, '\1') # Strip ignorable spaces
23
+ path.gsub!( /\s+([\]\)])/, '\1')
24
+ parsed = []
25
+ rest = OrExpr(path, parsed)
26
+ if rest
27
+ unless rest.strip.empty?
28
+ raise ParseException.new("Garbage component exists at the end: " +
29
+ "<#{rest}>: <#{path}>")
30
+ end
31
+ end
32
+ parsed
33
+ end
34
+
35
+ def predicate path
36
+ parsed = []
37
+ Predicate( "[#{path}]", parsed )
38
+ parsed
39
+ end
40
+
41
+ def abbreviate( path )
42
+ path = path.kind_of?(String) ? parse( path ) : path
43
+ string = ""
44
+ document = false
45
+ while path.size > 0
46
+ op = path.shift
47
+ case op
48
+ when :node
49
+ when :attribute
50
+ string << "/" if string.size > 0
51
+ string << "@"
52
+ when :child
53
+ string << "/" if string.size > 0
54
+ when :descendant_or_self
55
+ string << "/"
56
+ when :self
57
+ string << "."
58
+ when :parent
59
+ string << ".."
60
+ when :any
61
+ string << "*"
62
+ when :text
63
+ string << "text()"
64
+ when :following, :following_sibling,
65
+ :ancestor, :ancestor_or_self, :descendant,
66
+ :namespace, :preceding, :preceding_sibling
67
+ string << "/" unless string.size == 0
68
+ string << op.to_s.tr("_", "-")
69
+ string << "::"
70
+ when :qname
71
+ prefix = path.shift
72
+ name = path.shift
73
+ string << prefix+":" if prefix.size > 0
74
+ string << name
75
+ when :predicate
76
+ string << '['
77
+ string << predicate_to_string( path.shift ) {|x| abbreviate( x ) }
78
+ string << ']'
79
+ when :document
80
+ document = true
81
+ when :function
82
+ string << path.shift
83
+ string << "( "
84
+ string << predicate_to_string( path.shift[0] ) {|x| abbreviate( x )}
85
+ string << " )"
86
+ when :literal
87
+ string << %Q{ "#{path.shift}" }
88
+ else
89
+ string << "/" unless string.size == 0
90
+ string << "UNKNOWN("
91
+ string << op.inspect
92
+ string << ")"
93
+ end
94
+ end
95
+ string = "/"+string if document
96
+ return string
97
+ end
98
+
99
+ def expand( path )
100
+ path = path.kind_of?(String) ? parse( path ) : path
101
+ string = ""
102
+ document = false
103
+ while path.size > 0
104
+ op = path.shift
105
+ case op
106
+ when :node
107
+ string << "node()"
108
+ when :attribute, :child, :following, :following_sibling,
109
+ :ancestor, :ancestor_or_self, :descendant, :descendant_or_self,
110
+ :namespace, :preceding, :preceding_sibling, :self, :parent
111
+ string << "/" unless string.size == 0
112
+ string << op.to_s.tr("_", "-")
113
+ string << "::"
114
+ when :any
115
+ string << "*"
116
+ when :qname
117
+ prefix = path.shift
118
+ name = path.shift
119
+ string << prefix+":" if prefix.size > 0
120
+ string << name
121
+ when :predicate
122
+ string << '['
123
+ string << predicate_to_string( path.shift ) { |x| expand(x) }
124
+ string << ']'
125
+ when :document
126
+ document = true
127
+ else
128
+ string << "/" unless string.size == 0
129
+ string << "UNKNOWN("
130
+ string << op.inspect
131
+ string << ")"
132
+ end
133
+ end
134
+ string = "/"+string if document
135
+ return string
136
+ end
137
+
138
+ def predicate_to_string( path, &block )
139
+ string = ""
140
+ case path[0]
141
+ when :and, :or, :mult, :plus, :minus, :neq, :eq, :lt, :gt, :lteq, :gteq, :div, :mod, :union
142
+ op = path.shift
143
+ case op
144
+ when :eq
145
+ op = "="
146
+ when :lt
147
+ op = "<"
148
+ when :gt
149
+ op = ">"
150
+ when :lteq
151
+ op = "<="
152
+ when :gteq
153
+ op = ">="
154
+ when :neq
155
+ op = "!="
156
+ when :union
157
+ op = "|"
158
+ end
159
+ left = predicate_to_string( path.shift, &block )
160
+ right = predicate_to_string( path.shift, &block )
161
+ string << " "
162
+ string << left
163
+ string << " "
164
+ string << op.to_s
165
+ string << " "
166
+ string << right
167
+ string << " "
168
+ when :function
169
+ path.shift
170
+ name = path.shift
171
+ string << name
172
+ string << "( "
173
+ string << predicate_to_string( path.shift, &block )
174
+ string << " )"
175
+ when :literal
176
+ path.shift
177
+ string << " "
178
+ string << path.shift.inspect
179
+ string << " "
180
+ else
181
+ string << " "
182
+ string << yield( path )
183
+ string << " "
184
+ end
185
+ return string.squeeze(" ")
186
+ end
187
+
188
+ private
189
+ #LocationPath
190
+ # | RelativeLocationPath
191
+ # | '/' RelativeLocationPath?
192
+ # | '//' RelativeLocationPath
193
+ def LocationPath path, parsed
194
+ path = path.lstrip
195
+ if path[0] == ?/
196
+ parsed << :document
197
+ if path[1] == ?/
198
+ parsed << :descendant_or_self
199
+ parsed << :node
200
+ path = path[2..-1]
201
+ else
202
+ path = path[1..-1]
203
+ end
204
+ end
205
+ return RelativeLocationPath( path, parsed ) if path.size > 0
206
+ end
207
+
208
+ #RelativeLocationPath
209
+ # | Step
210
+ # | (AXIS_NAME '::' | '@' | '') AxisSpecifier
211
+ # NodeTest
212
+ # Predicate
213
+ # | '.' | '..' AbbreviatedStep
214
+ # | RelativeLocationPath '/' Step
215
+ # | RelativeLocationPath '//' Step
216
+ AXIS = /^(ancestor|ancestor-or-self|attribute|child|descendant|descendant-or-self|following|following-sibling|namespace|parent|preceding|preceding-sibling|self)::/
217
+ def RelativeLocationPath path, parsed
218
+ loop do
219
+ original_path = path
220
+ path = path.lstrip
221
+
222
+ return original_path if path.empty?
223
+
224
+ # (axis or @ or <child::>) nodetest predicate >
225
+ # OR > / Step
226
+ # (. or ..) >
227
+ if path[0] == ?.
228
+ if path[1] == ?.
229
+ parsed << :parent
230
+ parsed << :node
231
+ path = path[2..-1]
232
+ else
233
+ parsed << :self
234
+ parsed << :node
235
+ path = path[1..-1]
236
+ end
237
+ else
238
+ path_before_axis_specifier = path
239
+ parsed_not_abberviated = []
240
+ if path[0] == ?@
241
+ parsed_not_abberviated << :attribute
242
+ path = path[1..-1]
243
+ # Goto Nodetest
244
+ elsif path =~ AXIS
245
+ parsed_not_abberviated << $1.tr('-','_').intern
246
+ path = $'
247
+ # Goto Nodetest
248
+ else
249
+ parsed_not_abberviated << :child
250
+ end
251
+
252
+ path_before_node_test = path
253
+ path = NodeTest(path, parsed_not_abberviated)
254
+ if path == path_before_node_test
255
+ return path_before_axis_specifier
256
+ end
257
+ path = Predicate(path, parsed_not_abberviated)
258
+
259
+ parsed.concat(parsed_not_abberviated)
260
+ end
261
+
262
+ original_path = path
263
+ path = path.lstrip
264
+ return original_path if path.empty?
265
+
266
+ return original_path if path[0] != ?/
267
+
268
+ if path[1] == ?/
269
+ parsed << :descendant_or_self
270
+ parsed << :node
271
+ path = path[2..-1]
272
+ else
273
+ path = path[1..-1]
274
+ end
275
+ end
276
+ end
277
+
278
+ # Returns a 1-1 map of the nodeset
279
+ # The contents of the resulting array are either:
280
+ # true/false, if a positive match
281
+ # String, if a name match
282
+ #NodeTest
283
+ # | ('*' | NCNAME ':' '*' | QNAME) NameTest
284
+ # | '*' ':' NCNAME NameTest since XPath 2.0
285
+ # | NODE_TYPE '(' ')' NodeType
286
+ # | PI '(' LITERAL ')' PI
287
+ # | '[' expr ']' Predicate
288
+ PREFIX_WILDCARD = /^\*:(#{NCNAME_STR})/u
289
+ LOCAL_NAME_WILDCARD = /^(#{NCNAME_STR}):\*/u
290
+ QNAME = Namespace::NAMESPLIT
291
+ NODE_TYPE = /^(comment|text|node)\(\s*\)/m
292
+ PI = /^processing-instruction\(/
293
+ def NodeTest path, parsed
294
+ original_path = path
295
+ path = path.lstrip
296
+ case path
297
+ when PREFIX_WILDCARD
298
+ prefix = nil
299
+ name = $1
300
+ path = $'
301
+ parsed << :qname
302
+ parsed << prefix
303
+ parsed << name
304
+ when /^\*/
305
+ path = $'
306
+ parsed << :any
307
+ when NODE_TYPE
308
+ type = $1
309
+ path = $'
310
+ parsed << type.tr('-', '_').intern
311
+ when PI
312
+ path = $'
313
+ literal = nil
314
+ if path =~ /^\s*\)/
315
+ path = $'
316
+ else
317
+ path =~ LITERAL
318
+ literal = $1
319
+ path = $'
320
+ raise ParseException.new("Missing ')' after processing instruction") if path[0] != ?)
321
+ path = path[1..-1]
322
+ end
323
+ parsed << :processing_instruction
324
+ parsed << (literal || '')
325
+ when LOCAL_NAME_WILDCARD
326
+ prefix = $1
327
+ path = $'
328
+ parsed << :namespace
329
+ parsed << prefix
330
+ when QNAME
331
+ prefix = $1
332
+ name = $2
333
+ path = $'
334
+ prefix = "" unless prefix
335
+ parsed << :qname
336
+ parsed << prefix
337
+ parsed << name
338
+ else
339
+ path = original_path
340
+ end
341
+ return path
342
+ end
343
+
344
+ # Filters the supplied nodeset on the predicate(s)
345
+ def Predicate path, parsed
346
+ original_path = path
347
+ path = path.lstrip
348
+ return original_path unless path[0] == ?[
349
+ predicates = []
350
+ while path[0] == ?[
351
+ path, expr = get_group(path)
352
+ predicates << expr[1..-2] if expr
353
+ end
354
+ predicates.each{ |pred|
355
+ preds = []
356
+ parsed << :predicate
357
+ parsed << preds
358
+ OrExpr(pred, preds)
359
+ }
360
+ path
361
+ end
362
+
363
+ # The following return arrays of true/false, a 1-1 mapping of the
364
+ # supplied nodeset, except for axe(), which returns a filtered
365
+ # nodeset
366
+
367
+ #| OrExpr S 'or' S AndExpr
368
+ #| AndExpr
369
+ def OrExpr path, parsed
370
+ n = []
371
+ rest = AndExpr( path, n )
372
+ if rest != path
373
+ while rest =~ /^\s*( or )/
374
+ n = [ :or, n, [] ]
375
+ rest = AndExpr( $', n[-1] )
376
+ end
377
+ end
378
+ if parsed.size == 0 and n.size != 0
379
+ parsed.replace(n)
380
+ elsif n.size > 0
381
+ parsed << n
382
+ end
383
+ rest
384
+ end
385
+
386
+ #| AndExpr S 'and' S EqualityExpr
387
+ #| EqualityExpr
388
+ def AndExpr path, parsed
389
+ n = []
390
+ rest = EqualityExpr( path, n )
391
+ if rest != path
392
+ while rest =~ /^\s*( and )/
393
+ n = [ :and, n, [] ]
394
+ rest = EqualityExpr( $', n[-1] )
395
+ end
396
+ end
397
+ if parsed.size == 0 and n.size != 0
398
+ parsed.replace(n)
399
+ elsif n.size > 0
400
+ parsed << n
401
+ end
402
+ rest
403
+ end
404
+
405
+ #| EqualityExpr ('=' | '!=') RelationalExpr
406
+ #| RelationalExpr
407
+ def EqualityExpr path, parsed
408
+ n = []
409
+ rest = RelationalExpr( path, n )
410
+ if rest != path
411
+ while rest =~ /^\s*(!?=)\s*/
412
+ if $1[0] == ?!
413
+ n = [ :neq, n, [] ]
414
+ else
415
+ n = [ :eq, n, [] ]
416
+ end
417
+ rest = RelationalExpr( $', n[-1] )
418
+ end
419
+ end
420
+ if parsed.size == 0 and n.size != 0
421
+ parsed.replace(n)
422
+ elsif n.size > 0
423
+ parsed << n
424
+ end
425
+ rest
426
+ end
427
+
428
+ #| RelationalExpr ('<' | '>' | '<=' | '>=') AdditiveExpr
429
+ #| AdditiveExpr
430
+ def RelationalExpr path, parsed
431
+ n = []
432
+ rest = AdditiveExpr( path, n )
433
+ if rest != path
434
+ while rest =~ /^\s*([<>]=?)\s*/
435
+ if $1[0] == ?<
436
+ sym = "lt"
437
+ else
438
+ sym = "gt"
439
+ end
440
+ sym << "eq" if $1[-1] == ?=
441
+ n = [ sym.intern, n, [] ]
442
+ rest = AdditiveExpr( $', n[-1] )
443
+ end
444
+ end
445
+ if parsed.size == 0 and n.size != 0
446
+ parsed.replace(n)
447
+ elsif n.size > 0
448
+ parsed << n
449
+ end
450
+ rest
451
+ end
452
+
453
+ #| AdditiveExpr ('+' | '-') MultiplicativeExpr
454
+ #| MultiplicativeExpr
455
+ def AdditiveExpr path, parsed
456
+ n = []
457
+ rest = MultiplicativeExpr( path, n )
458
+ if rest != path
459
+ while rest =~ /^\s*(\+|-)\s*/
460
+ if $1[0] == ?+
461
+ n = [ :plus, n, [] ]
462
+ else
463
+ n = [ :minus, n, [] ]
464
+ end
465
+ rest = MultiplicativeExpr( $', n[-1] )
466
+ end
467
+ end
468
+ if parsed.size == 0 and n.size != 0
469
+ parsed.replace(n)
470
+ elsif n.size > 0
471
+ parsed << n
472
+ end
473
+ rest
474
+ end
475
+
476
+ #| MultiplicativeExpr ('*' | S ('div' | 'mod') S) UnaryExpr
477
+ #| UnaryExpr
478
+ def MultiplicativeExpr path, parsed
479
+ n = []
480
+ rest = UnaryExpr( path, n )
481
+ if rest != path
482
+ while rest =~ /^\s*(\*| div | mod )\s*/
483
+ if $1[0] == ?*
484
+ n = [ :mult, n, [] ]
485
+ elsif $1.include?( "div" )
486
+ n = [ :div, n, [] ]
487
+ else
488
+ n = [ :mod, n, [] ]
489
+ end
490
+ rest = UnaryExpr( $', n[-1] )
491
+ end
492
+ end
493
+ if parsed.size == 0 and n.size != 0
494
+ parsed.replace(n)
495
+ elsif n.size > 0
496
+ parsed << n
497
+ end
498
+ rest
499
+ end
500
+
501
+ #| '-' UnaryExpr
502
+ #| UnionExpr
503
+ def UnaryExpr path, parsed
504
+ path =~ /^(\-*)/
505
+ path = $'
506
+ if $1 and (($1.size % 2) != 0)
507
+ mult = -1
508
+ else
509
+ mult = 1
510
+ end
511
+ parsed << :neg if mult < 0
512
+
513
+ n = []
514
+ path = UnionExpr( path, n )
515
+ parsed.concat( n )
516
+ path
517
+ end
518
+
519
+ #| UnionExpr '|' PathExpr
520
+ #| PathExpr
521
+ def UnionExpr path, parsed
522
+ n = []
523
+ rest = PathExpr( path, n )
524
+ if rest != path
525
+ while rest =~ /^\s*(\|)\s*/
526
+ n = [ :union, n, [] ]
527
+ rest = PathExpr( $', n[-1] )
528
+ end
529
+ end
530
+ if parsed.size == 0 and n.size != 0
531
+ parsed.replace( n )
532
+ elsif n.size > 0
533
+ parsed << n
534
+ end
535
+ rest
536
+ end
537
+
538
+ #| LocationPath
539
+ #| FilterExpr ('/' | '//') RelativeLocationPath
540
+ def PathExpr path, parsed
541
+ path = path.lstrip
542
+ n = []
543
+ rest = FilterExpr( path, n )
544
+ if rest != path
545
+ if rest and rest[0] == ?/
546
+ rest = RelativeLocationPath(rest, n)
547
+ parsed.concat(n)
548
+ return rest
549
+ end
550
+ end
551
+ rest = LocationPath(rest, n) if rest =~ /\A[\/\.\@\[\w*]/
552
+ parsed.concat(n)
553
+ return rest
554
+ end
555
+
556
+ #| FilterExpr Predicate
557
+ #| PrimaryExpr
558
+ def FilterExpr path, parsed
559
+ n = []
560
+ path_before_primary_expr = path
561
+ path = PrimaryExpr(path, n)
562
+ return path_before_primary_expr if path == path_before_primary_expr
563
+ path = Predicate(path, n)
564
+ parsed.concat(n)
565
+ path
566
+ end
567
+
568
+ #| VARIABLE_REFERENCE
569
+ #| '(' expr ')'
570
+ #| LITERAL
571
+ #| NUMBER
572
+ #| FunctionCall
573
+ VARIABLE_REFERENCE = /^\$(#{NAME_STR})/u
574
+ NUMBER = /^(\d*\.?\d+)/
575
+ NT = /^comment|text|processing-instruction|node$/
576
+ def PrimaryExpr path, parsed
577
+ case path
578
+ when VARIABLE_REFERENCE
579
+ varname = $1
580
+ path = $'
581
+ parsed << :variable
582
+ parsed << varname
583
+ #arry << @variables[ varname ]
584
+ when /^(\w[-\w]*)(?:\()/
585
+ fname = $1
586
+ tmp = $'
587
+ return path if fname =~ NT
588
+ path = tmp
589
+ parsed << :function
590
+ parsed << fname
591
+ path = FunctionCall(path, parsed)
592
+ when NUMBER
593
+ varname = $1.nil? ? $2 : $1
594
+ path = $'
595
+ parsed << :literal
596
+ parsed << (varname.include?('.') ? varname.to_f : varname.to_i)
597
+ when LITERAL
598
+ varname = $1.nil? ? $2 : $1
599
+ path = $'
600
+ parsed << :literal
601
+ parsed << varname
602
+ when /^\(/ #/
603
+ path, contents = get_group(path)
604
+ contents = contents[1..-2]
605
+ n = []
606
+ OrExpr( contents, n )
607
+ parsed.concat(n)
608
+ end
609
+ path
610
+ end
611
+
612
+ #| FUNCTION_NAME '(' ( expr ( ',' expr )* )? ')'
613
+ def FunctionCall rest, parsed
614
+ path, arguments = parse_args(rest)
615
+ argset = []
616
+ for argument in arguments
617
+ args = []
618
+ OrExpr( argument, args )
619
+ argset << args
620
+ end
621
+ parsed << argset
622
+ path
623
+ end
624
+
625
+ # get_group( '[foo]bar' ) -> ['bar', '[foo]']
626
+ def get_group string
627
+ ind = 0
628
+ depth = 0
629
+ st = string[0,1]
630
+ en = (st == "(" ? ")" : "]")
631
+ begin
632
+ case string[ind,1]
633
+ when st
634
+ depth += 1
635
+ when en
636
+ depth -= 1
637
+ end
638
+ ind += 1
639
+ end while depth > 0 and ind < string.length
640
+ return nil unless depth==0
641
+ [string[ind..-1], string[0..ind-1]]
642
+ end
643
+
644
+ def parse_args( string )
645
+ arguments = []
646
+ ind = 0
647
+ inquot = false
648
+ inapos = false
649
+ depth = 1
650
+ begin
651
+ case string[ind]
652
+ when ?"
653
+ inquot = !inquot unless inapos
654
+ when ?'
655
+ inapos = !inapos unless inquot
656
+ else
657
+ unless inquot or inapos
658
+ case string[ind]
659
+ when ?(
660
+ depth += 1
661
+ if depth == 1
662
+ string = string[1..-1]
663
+ ind -= 1
664
+ end
665
+ when ?)
666
+ depth -= 1
667
+ if depth == 0
668
+ s = string[0,ind].strip
669
+ arguments << s unless s == ""
670
+ string = string[ind+1..-1]
671
+ end
672
+ when ?,
673
+ if depth == 1
674
+ s = string[0,ind].strip
675
+ arguments << s unless s == ""
676
+ string = string[ind+1..-1]
677
+ ind = -1
678
+ end
679
+ end
680
+ end
681
+ end
682
+ ind += 1
683
+ end while depth > 0 and ind < string.length
684
+ return nil unless depth==0
685
+ [string,arguments]
686
+ end
687
+ end
688
+ end
689
+ end