ox-bundlecachetest 2.14.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +751 -0
  3. data/LICENSE +21 -0
  4. data/README.md +351 -0
  5. data/ext/ox/attr.h +78 -0
  6. data/ext/ox/base64.c +105 -0
  7. data/ext/ox/base64.h +18 -0
  8. data/ext/ox/buf.h +162 -0
  9. data/ext/ox/builder.c +948 -0
  10. data/ext/ox/cache.c +351 -0
  11. data/ext/ox/cache.h +21 -0
  12. data/ext/ox/cache8.c +106 -0
  13. data/ext/ox/cache8.h +23 -0
  14. data/ext/ox/dump.c +1260 -0
  15. data/ext/ox/err.c +46 -0
  16. data/ext/ox/err.h +36 -0
  17. data/ext/ox/extconf.rb +47 -0
  18. data/ext/ox/gen_load.c +342 -0
  19. data/ext/ox/hash_load.c +309 -0
  20. data/ext/ox/helper.h +84 -0
  21. data/ext/ox/intern.c +157 -0
  22. data/ext/ox/intern.h +25 -0
  23. data/ext/ox/obj_load.c +809 -0
  24. data/ext/ox/ox.c +1649 -0
  25. data/ext/ox/ox.h +245 -0
  26. data/ext/ox/parse.c +1197 -0
  27. data/ext/ox/sax.c +1570 -0
  28. data/ext/ox/sax.h +69 -0
  29. data/ext/ox/sax_as.c +270 -0
  30. data/ext/ox/sax_buf.c +209 -0
  31. data/ext/ox/sax_buf.h +204 -0
  32. data/ext/ox/sax_hint.c +207 -0
  33. data/ext/ox/sax_hint.h +40 -0
  34. data/ext/ox/sax_stack.h +113 -0
  35. data/ext/ox/slotcache.c +158 -0
  36. data/ext/ox/slotcache.h +19 -0
  37. data/ext/ox/special.c +390 -0
  38. data/ext/ox/special.h +14 -0
  39. data/ext/ox/type.h +39 -0
  40. data/lib/ox/bag.rb +103 -0
  41. data/lib/ox/cdata.rb +10 -0
  42. data/lib/ox/comment.rb +11 -0
  43. data/lib/ox/doctype.rb +11 -0
  44. data/lib/ox/document.rb +28 -0
  45. data/lib/ox/element.rb +464 -0
  46. data/lib/ox/error.rb +25 -0
  47. data/lib/ox/hasattrs.rb +54 -0
  48. data/lib/ox/instruct.rb +34 -0
  49. data/lib/ox/node.rb +23 -0
  50. data/lib/ox/raw.rb +12 -0
  51. data/lib/ox/sax.rb +97 -0
  52. data/lib/ox/version.rb +4 -0
  53. data/lib/ox/xmlrpc_adapter.rb +33 -0
  54. data/lib/ox.rb +79 -0
  55. metadata +128 -0
@@ -0,0 +1,54 @@
1
+ module Ox
2
+ # An Object that includes the HasAttrs module can have attributes which are a Hash of String values and either String
3
+ # or Symbol keys.
4
+ #
5
+ # To access the attributes there are several options. One is to walk the attributes. The easiest for simple regularly
6
+ # formatted XML is to reference the attributes simply by name.
7
+ module HasAttrs
8
+ # Returns all the attributes of the Instruct as a Hash.
9
+ # *return* [Hash] all attributes and attribute values.
10
+ def attributes
11
+ @attributes = {} if !instance_variable_defined?(:@attributes) or @attributes.nil?
12
+ @attributes
13
+ end
14
+
15
+ # Returns the value of an attribute.
16
+ # - +attr+ [Symbol|String] attribute name or key to return the value for
17
+ def [](attr)
18
+ return nil unless instance_variable_defined?(:@attributes) and @attributes.is_a?(Hash)
19
+
20
+ @attributes[attr] or (attr.is_a?(String) ? @attributes[attr.to_sym] : @attributes[attr.to_s])
21
+ end
22
+
23
+ # Adds or set an attribute of the Instruct.
24
+ # - +attr+ [Symbol|String] attribute name or key
25
+ # - +value+ [Object] value for the attribute
26
+ def []=(attr, value)
27
+ raise 'argument to [] must be a Symbol or a String.' unless attr.is_a?(Symbol) or attr.is_a?(String)
28
+
29
+ @attributes = {} if !instance_variable_defined?(:@attributes) or @attributes.nil?
30
+ a_str = attr.to_s
31
+ a_sym = attr.to_sym
32
+ if @attributes.has_key?(a_str)
33
+ attr = a_str
34
+ elsif @attributes.has_key?(a_sym)
35
+ attr = a_sym
36
+ end
37
+ @attributes[attr] = value.to_s
38
+ end
39
+
40
+ # Handles the 'easy' API that allows navigating a simple XML by
41
+ # referencing attributes by name.
42
+ # - +id+ [Symbol] element or attribute name
43
+ # *return* [String|nil] the attribute value
44
+ # _raise_ [NoMethodError] if no match is found
45
+ def method_missing(id, *args, &block)
46
+ ids = id.to_s
47
+ if instance_variable_defined?(:@attributes)
48
+ return @attributes[id] if @attributes.has_key?(id)
49
+ return @attributes[ids] if @attributes.has_key?(ids)
50
+ end
51
+ raise NoMethodError.new("#{ids} not found", name)
52
+ end
53
+ end # HasAttrs
54
+ end # Ox
@@ -0,0 +1,34 @@
1
+ module Ox
2
+ # An Instruct represents a processing instruction of an XML document. It has a target, attributes, and a value or
3
+ # content. The content will be all characters with the exception of the target. If the content follows a regular
4
+ # attribute format then the attributes will be set to the parsed values. If it does not follow the attribute formate
5
+ # then the attributes will be empty.
6
+ class Instruct < Node
7
+ include HasAttrs
8
+
9
+ # The content of the processing instruction.
10
+ attr_accessor :content
11
+
12
+ # Creates a new Instruct with the specified name.
13
+ # - +name+ [String] name of the Instruct
14
+ def initialize(name)
15
+ super
16
+ @attributes = nil
17
+ @content = nil
18
+ end
19
+ alias target value
20
+
21
+ # Returns true if this Object and other are of the same type and have the
22
+ # equivalent value and the equivalent elements otherwise false is returned.
23
+ # - +other+ [Object] Object compare _self_ to.
24
+ # *return* [Boolean] true if both Objects are equivalent, otherwise false.
25
+ def eql?(other)
26
+ return false unless super
27
+ return false unless attributes == other.attributes
28
+ return false unless content == other.content
29
+
30
+ true
31
+ end
32
+ alias == eql?
33
+ end # Instruct
34
+ end # Ox
data/lib/ox/node.rb ADDED
@@ -0,0 +1,23 @@
1
+ module Ox
2
+ # The Node is the base class for all other in the Ox module.
3
+ class Node
4
+ # String value associated with the Node.
5
+ attr_accessor :value
6
+
7
+ # Creates a new Node with the specified String value.
8
+ # - +value+ [String] string value for the Node
9
+ def initialize(value)
10
+ @value = value.to_s
11
+ end
12
+
13
+ # Returns true if this Object and other are of the same type and have the
14
+ # equivalent value otherwise false is returned.
15
+ # - +other+ [Object] Object to compare _self_ to.
16
+ def eql?(other)
17
+ return false if (other.nil? or self.class != other.class)
18
+
19
+ other.value == value
20
+ end
21
+ alias == eql?
22
+ end # Node
23
+ end # Ox
data/lib/ox/raw.rb ADDED
@@ -0,0 +1,12 @@
1
+ module Ox
2
+ # Raw elements are used to inject existing XML strings into a document
3
+ # WARNING: Use of this feature can result in invalid XML, since `value` is
4
+ # injected as-is.
5
+ class Raw < Node
6
+ # Creates a new Raw element with the specified value.
7
+ # - +value+ [String] string value for the comment
8
+ def initialize(value)
9
+ super
10
+ end
11
+ end # Raw
12
+ end # Ox
data/lib/ox/sax.rb ADDED
@@ -0,0 +1,97 @@
1
+ module Ox
2
+ # A SAX style parse handler. The Ox::Sax handler class should be subclasses
3
+ # and then used with the Ox.sax_parse() method. The Sax methods will then be
4
+ # called as the file is parsed. This is best suited for very large files or
5
+ # IO streams.<p/>
6
+ #
7
+ # *Example*
8
+ #
9
+ # require 'ox'
10
+ #
11
+ # class MySax < ::Ox::Sax
12
+ # def initialize()
13
+ # @element_names = []
14
+ # end
15
+ #
16
+ # def start_element(name)
17
+ # @element_names << name
18
+ # end
19
+ # end
20
+ #
21
+ # any = MySax.new()
22
+ # File.open('any.xml', 'r') do |f|
23
+ # Ox.sax_parse(any, f)
24
+ # end
25
+ #
26
+ # To make the desired methods active while parsing the desired method should
27
+ # be made public in the subclasses. If the methods remain private they will
28
+ # not be called during parsing. The 'name' argument in the callback methods
29
+ # will be a Symbol. The 'str' arguments will be a String. The 'value'
30
+ # arguments will be Ox::Sax::Value objects. Since both the text() and the
31
+ # value() methods are called for the same element in the XML document the the
32
+ # text() method is ignored if the value() method is defined or public. The
33
+ # same is true for attr() and attr_value(). When all attributes have been read
34
+ # the attr_done() callback will be invoked.
35
+ #
36
+ # def instruct(target); end
37
+ # def end_instruct(target); end
38
+ # def attr(name, str); end
39
+ # def attr_value(name, value); end
40
+ # def attrs_done(); end
41
+ # def doctype(str); end
42
+ # def comment(str); end
43
+ # def cdata(str); end
44
+ # def text(str); end
45
+ # def value(value); end
46
+ # def start_element(name); end
47
+ # def end_element(name); end
48
+ # def error(message, line, column); end
49
+ # def abort(name); end
50
+ #
51
+ # Initializing _line_ attribute in the initializer will cause that variable to
52
+ # be updated before each callback with the XML line number. The same is true
53
+ # for the _column_ attribute but it will be updated with the column in the XML
54
+ # file that is the start of the element or node just read. @pos if defined
55
+ # will hold the number of bytes from the start of the document.
56
+ class Sax
57
+ # Create a new instance of the Sax handler class.
58
+ def initialize
59
+ # @pos = nil
60
+ # @line = nil
61
+ # @column = nil
62
+ end
63
+
64
+ # To make the desired methods active while parsing the desired method
65
+ # should be made public in the subclasses. If the methods remain private
66
+ # they will not be called during parsing.
67
+ private
68
+
69
+ def instruct(target); end
70
+
71
+ def end_instruct(target); end
72
+
73
+ def attr(name, str); end
74
+
75
+ def attr_value(name, value); end
76
+
77
+ def attrs_done; end
78
+
79
+ def doctype(str); end
80
+
81
+ def comment(str); end
82
+
83
+ def cdata(str); end
84
+
85
+ def text(str); end
86
+
87
+ def value(value); end
88
+
89
+ def start_element(name); end
90
+
91
+ def end_element(name); end
92
+
93
+ def error(message, line, column); end
94
+
95
+ def abort(name); end
96
+ end # Sax
97
+ end # Ox
data/lib/ox/version.rb ADDED
@@ -0,0 +1,4 @@
1
+ module Ox
2
+ # Current version of the module.
3
+ VERSION = '2.14.23'
4
+ end
@@ -0,0 +1,33 @@
1
+ require 'ox'
2
+
3
+ module Ox
4
+ # This is an alternative parser for the stdlib xmlrpc library. It makes
5
+ # use of Ox and is based on REXMLStreamParser. To use it set is as the
6
+ # parser for an XMLRPC client:
7
+ #
8
+ # require 'xmlrpc/client'
9
+ # require 'ox/xmlrpc_adapter'
10
+ # client = XMLRPC::Client.new2('http://some_server/rpc')
11
+ # client.set_parser(Ox::StreamParser.new)
12
+ class StreamParser < XMLRPC::XMLParser::AbstractStreamParser
13
+ # Create a new instance.
14
+ def initialize
15
+ super
16
+ @parser_class = OxParser
17
+ end
18
+
19
+ # The SAX wrapper.
20
+ class OxParser < Ox::Sax
21
+ include XMLRPC::XMLParser::StreamParserMixin
22
+
23
+ alias text character
24
+ alias end_element endElement
25
+ alias start_element startElement
26
+
27
+ # Initiates the sax parser with the provided string.
28
+ def parse(str)
29
+ Ox.sax_parse(self, StringIO.new(str), symbolize: false, convert_special: true)
30
+ end
31
+ end
32
+ end
33
+ end
data/lib/ox.rb ADDED
@@ -0,0 +1,79 @@
1
+ # Copyright (c) 2011, Peter Ohler<br>
2
+ # All rights reserved.
3
+
4
+ #
5
+ # === Description:
6
+ #
7
+ # Ox handles XML documents in two ways. It is a generic XML parser and writer as
8
+ # well as a fast Object / XML marshaller. Ox was written for speed as a
9
+ # replacement for Nokogiri and for Marshal.
10
+ #
11
+ # As an XML parser it is 2 or more times faster than Nokogiri and as a generic
12
+ # XML writer it is 14 times faster than Nokogiri. Of course different files may
13
+ # result in slightly different times.
14
+ #
15
+ # As an Object serializer Ox is 4 times faster than the standard Ruby
16
+ # Marshal.dump(). Ox is 3 times faster than Marshal.load().
17
+ #
18
+ # === Object Dump Sample:
19
+ #
20
+ # require 'ox'
21
+ #
22
+ # class Sample
23
+ # attr_accessor :a, :b, :c
24
+ #
25
+ # def initialize(a, b, c)
26
+ # @a = a
27
+ # @b = b
28
+ # @c = c
29
+ # end
30
+ # end
31
+ #
32
+ # # Create Object
33
+ # obj = Sample.new(1, "bee", ['x', :y, 7.0])
34
+ # # Now dump the Object to an XML String.
35
+ # xml = Ox.dump(obj)
36
+ # # Convert the object back into a Sample Object.
37
+ # obj2 = Ox.parse_obj(xml)
38
+ #
39
+ # === Generic XML Writing and Parsing:
40
+ #
41
+ # require 'ox'
42
+ #
43
+ # doc = Ox::Document.new(:version => '1.0')
44
+ #
45
+ # top = Ox::Element.new('top')
46
+ # top[:name] = 'sample'
47
+ # doc << top
48
+ #
49
+ # mid = Ox::Element.new('middle')
50
+ # mid[:name] = 'second'
51
+ # top << mid
52
+ #
53
+ # bot = Ox::Element.new('bottom')
54
+ # bot[:name] = 'third'
55
+ # mid << bot
56
+ #
57
+ # xml = Ox.dump(doc)
58
+ # puts xml
59
+ # doc2 = Ox.parse(xml)
60
+ # puts "Same? #{doc == doc2}"
61
+ module Ox
62
+ end
63
+
64
+ require 'ox/version'
65
+ require 'ox/error'
66
+ require 'ox/hasattrs'
67
+ require 'ox/node'
68
+ require 'ox/comment'
69
+ require 'ox/raw'
70
+ require 'ox/instruct'
71
+ require 'ox/cdata'
72
+ require 'ox/doctype'
73
+ require 'ox/element'
74
+ require 'ox/document'
75
+ require 'ox/bag'
76
+ require 'ox/sax'
77
+
78
+ # C extension
79
+ require 'ox/ox'
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ox-bundlecachetest
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.14.23
5
+ platform: ruby
6
+ authors:
7
+ - Peter Ohler
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: bigdecimal
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '3.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '3.0'
26
+ description: "A fast XML parser and object serializer that uses only standard C lib.\n\nOptimized
27
+ XML (Ox), as the name implies was written to provide speed optimized\nXML handling.
28
+ It was designed to be an alternative to Nokogiri and other Ruby\nXML parsers for
29
+ generic XML parsing and as an alternative to Marshal for Object\nserialization. "
30
+ email: peter@ohler.com
31
+ executables: []
32
+ extensions:
33
+ - ext/ox/extconf.rb
34
+ extra_rdoc_files:
35
+ - CHANGELOG.md
36
+ - README.md
37
+ files:
38
+ - CHANGELOG.md
39
+ - LICENSE
40
+ - README.md
41
+ - ext/ox/attr.h
42
+ - ext/ox/base64.c
43
+ - ext/ox/base64.h
44
+ - ext/ox/buf.h
45
+ - ext/ox/builder.c
46
+ - ext/ox/cache.c
47
+ - ext/ox/cache.h
48
+ - ext/ox/cache8.c
49
+ - ext/ox/cache8.h
50
+ - ext/ox/dump.c
51
+ - ext/ox/err.c
52
+ - ext/ox/err.h
53
+ - ext/ox/extconf.rb
54
+ - ext/ox/gen_load.c
55
+ - ext/ox/hash_load.c
56
+ - ext/ox/helper.h
57
+ - ext/ox/intern.c
58
+ - ext/ox/intern.h
59
+ - ext/ox/obj_load.c
60
+ - ext/ox/ox.c
61
+ - ext/ox/ox.h
62
+ - ext/ox/parse.c
63
+ - ext/ox/sax.c
64
+ - ext/ox/sax.h
65
+ - ext/ox/sax_as.c
66
+ - ext/ox/sax_buf.c
67
+ - ext/ox/sax_buf.h
68
+ - ext/ox/sax_hint.c
69
+ - ext/ox/sax_hint.h
70
+ - ext/ox/sax_stack.h
71
+ - ext/ox/slotcache.c
72
+ - ext/ox/slotcache.h
73
+ - ext/ox/special.c
74
+ - ext/ox/special.h
75
+ - ext/ox/type.h
76
+ - lib/ox.rb
77
+ - lib/ox/bag.rb
78
+ - lib/ox/cdata.rb
79
+ - lib/ox/comment.rb
80
+ - lib/ox/doctype.rb
81
+ - lib/ox/document.rb
82
+ - lib/ox/element.rb
83
+ - lib/ox/error.rb
84
+ - lib/ox/hasattrs.rb
85
+ - lib/ox/instruct.rb
86
+ - lib/ox/node.rb
87
+ - lib/ox/raw.rb
88
+ - lib/ox/sax.rb
89
+ - lib/ox/version.rb
90
+ - lib/ox/xmlrpc_adapter.rb
91
+ homepage: http://www.ohler.com/ox
92
+ licenses:
93
+ - MIT
94
+ metadata:
95
+ bug_tracker_uri: https://github.com/ohler55/ox/issues
96
+ changelog_uri: https://github.com/ohler55/ox/blob/master/CHANGELOG.md
97
+ documentation_uri: http://www.ohler.com/ox/doc/index.html
98
+ homepage_uri: http://www.ohler.com/ox/
99
+ source_code_uri: https://github.com/ohler55/ox
100
+ rubygems_mfa_required: 'true'
101
+ rdoc_options:
102
+ - "--main"
103
+ - README.md
104
+ - "--title"
105
+ - Ox
106
+ - "--exclude"
107
+ - extconf.rb
108
+ - lib
109
+ - ext/ox
110
+ - README.md
111
+ require_paths:
112
+ - lib
113
+ - ext
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: 2.7.0
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ requirements: []
125
+ rubygems_version: 4.0.3
126
+ specification_version: 4
127
+ summary: A fast XML parser and object serializer.
128
+ test_files: []