Class: Lutaml::Xml::Schema::Builder::Oga
- Inherits:
-
Object
- Object
- Lutaml::Xml::Schema::Builder::Oga
- Defined in:
- lib/lutaml/xml/schema/builder/oga.rb
Overview
Oga adapter for XSD schema generation Wraps Oga XML building to provide schema building capabilities
Defined Under Namespace
Classes: OgaBuilderWrapper
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
Instance Method Summary collapse
-
#initialize(options = {}) {|@builder| ... } ⇒ Oga
constructor
A new instance of Oga.
-
#method_missing(method_name) ⇒ Object
Forward all other methods to the builder wrapper.
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
-
#to_xml(_options = {}) ⇒ String
Generate the XSD schema XML string.
Constructor Details
#initialize(options = {}) {|@builder| ... } ⇒ Oga
Returns a new instance of Oga.
14 15 16 17 18 19 20 21 |
# File 'lib/lutaml/xml/schema/builder/oga.rb', line 14 def initialize( = {}) @encoding = [:encoding] || "UTF-8" @document = ::Oga::XML::Document.new @builder = OgaBuilderWrapper.new(@document, @encoding) # Execute the block if provided yield(@builder) if block_given? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name) ⇒ Object
Forward all other methods to the builder wrapper
34 35 36 |
# File 'lib/lutaml/xml/schema/builder/oga.rb', line 34 def method_missing(method_name, ...) @builder.public_send(method_name, ...) end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
12 13 14 |
# File 'lib/lutaml/xml/schema/builder/oga.rb', line 12 def document @document end |
Instance Method Details
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
38 39 40 |
# File 'lib/lutaml/xml/schema/builder/oga.rb', line 38 def respond_to_missing?(method_name, include_private = false) @builder.respond_to?(method_name, include_private) || super end |
#to_xml(_options = {}) ⇒ String
Generate the XSD schema XML string
27 28 29 30 31 |
# File 'lib/lutaml/xml/schema/builder/oga.rb', line 27 def to_xml( = {}) xml = @document.to_xml # Add XML declaration with encoding "<?xml version=\"1.0\" encoding=\"#{@encoding}\"?>\n#{xml}" end |