moxml 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/main.yml +27 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +8 -0
- data/Gemfile +12 -0
- data/README.adoc +770 -0
- data/Rakefile +12 -0
- data/bin/console +11 -0
- data/bin/setup +8 -0
- data/lib/moxml/adapter.rb +175 -0
- data/lib/moxml/attribute.rb +30 -0
- data/lib/moxml/cdata.rb +39 -0
- data/lib/moxml/comment.rb +35 -0
- data/lib/moxml/config.rb +23 -0
- data/lib/moxml/declaration.rb +50 -0
- data/lib/moxml/document.rb +99 -0
- data/lib/moxml/element.rb +145 -0
- data/lib/moxml/error_handler.rb +77 -0
- data/lib/moxml/errors.rb +169 -0
- data/lib/moxml/namespace.rb +54 -0
- data/lib/moxml/node.rb +113 -0
- data/lib/moxml/node_set.rb +268 -0
- data/lib/moxml/processing_instruction.rb +44 -0
- data/lib/moxml/text.rb +39 -0
- data/lib/moxml/version.rb +5 -0
- data/lib/moxml.rb +44 -0
- data/moxml.gemspec +34 -0
- data/sig/moxml.rbs +4 -0
- metadata +74 -0
data/lib/moxml.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# lib/moxml.rb
|
2
|
+
require_relative "moxml/version"
|
3
|
+
require_relative "moxml/config"
|
4
|
+
require_relative "moxml/document"
|
5
|
+
require_relative "moxml/node"
|
6
|
+
require_relative "moxml/element"
|
7
|
+
require_relative "moxml/text"
|
8
|
+
require_relative "moxml/cdata_section"
|
9
|
+
require_relative "moxml/comment"
|
10
|
+
require_relative "moxml/processing_instruction"
|
11
|
+
require_relative "moxml/visitor"
|
12
|
+
require_relative "moxml/errors"
|
13
|
+
require_relative "moxml/backends/base"
|
14
|
+
|
15
|
+
module Moxml
|
16
|
+
class << self
|
17
|
+
def config
|
18
|
+
@config ||= Config.new
|
19
|
+
end
|
20
|
+
|
21
|
+
def configure
|
22
|
+
yield(config)
|
23
|
+
end
|
24
|
+
|
25
|
+
def backend
|
26
|
+
@backend ||= begin
|
27
|
+
backend_class = case config.backend
|
28
|
+
when :nokogiri
|
29
|
+
require_relative "moxml/backends/nokogiri"
|
30
|
+
Backends::Nokogiri
|
31
|
+
when :ox
|
32
|
+
require_relative "moxml/backends/ox"
|
33
|
+
Backends::Ox
|
34
|
+
when :oga
|
35
|
+
require_relative "moxml/backends/oga"
|
36
|
+
Backends::Oga
|
37
|
+
else
|
38
|
+
raise ArgumentError, "Unknown backend: #{config.backend}"
|
39
|
+
end
|
40
|
+
backend_class.new
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/moxml.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/moxml/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "moxml"
|
7
|
+
spec.version = Moxml::VERSION
|
8
|
+
spec.authors = ["Ribose Inc."]
|
9
|
+
spec.email = ["open.source@ribose.com"]
|
10
|
+
|
11
|
+
spec.summary = "Unified XML manipulation library"
|
12
|
+
spec.description = <<~DESCRIPTION
|
13
|
+
Moxml is a unified XML manipulation library that provides a common API.
|
14
|
+
DESCRIPTION
|
15
|
+
|
16
|
+
spec.homepage = "https://github.com/lutaml/moxml"
|
17
|
+
spec.license = "BSD-2-Clause"
|
18
|
+
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the
|
25
|
+
# RubyGem that have been added into git.
|
26
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
27
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
28
|
+
f.match(%r{^(test|spec|features)/})
|
29
|
+
end
|
30
|
+
end
|
31
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
|
+
|
33
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
34
|
+
end
|
data/sig/moxml.rbs
ADDED
metadata
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: moxml
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ribose Inc.
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-10-30 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: 'Moxml is a unified XML manipulation library that provides a common API.
|
14
|
+
|
15
|
+
'
|
16
|
+
email:
|
17
|
+
- open.source@ribose.com
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- ".github/workflows/main.yml"
|
23
|
+
- ".gitignore"
|
24
|
+
- ".rspec"
|
25
|
+
- ".rubocop.yml"
|
26
|
+
- Gemfile
|
27
|
+
- README.adoc
|
28
|
+
- Rakefile
|
29
|
+
- bin/console
|
30
|
+
- bin/setup
|
31
|
+
- lib/moxml.rb
|
32
|
+
- lib/moxml/adapter.rb
|
33
|
+
- lib/moxml/attribute.rb
|
34
|
+
- lib/moxml/cdata.rb
|
35
|
+
- lib/moxml/comment.rb
|
36
|
+
- lib/moxml/config.rb
|
37
|
+
- lib/moxml/declaration.rb
|
38
|
+
- lib/moxml/document.rb
|
39
|
+
- lib/moxml/element.rb
|
40
|
+
- lib/moxml/error_handler.rb
|
41
|
+
- lib/moxml/errors.rb
|
42
|
+
- lib/moxml/namespace.rb
|
43
|
+
- lib/moxml/node.rb
|
44
|
+
- lib/moxml/node_set.rb
|
45
|
+
- lib/moxml/processing_instruction.rb
|
46
|
+
- lib/moxml/text.rb
|
47
|
+
- lib/moxml/version.rb
|
48
|
+
- moxml.gemspec
|
49
|
+
- sig/moxml.rbs
|
50
|
+
homepage: https://github.com/lutaml/moxml
|
51
|
+
licenses:
|
52
|
+
- BSD-2-Clause
|
53
|
+
metadata:
|
54
|
+
rubygems_mfa_required: 'true'
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 3.0.0
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
requirements: []
|
70
|
+
rubygems_version: 3.5.22
|
71
|
+
signing_key:
|
72
|
+
specification_version: 4
|
73
|
+
summary: Unified XML manipulation library
|
74
|
+
test_files: []
|