Class: Lutaml::Model::Schema::SchemaBuilder::Nokogiri
- Inherits:
-
Object
- Object
- Lutaml::Model::Schema::SchemaBuilder::Nokogiri
- Defined in:
- lib/lutaml/model/schema/schema_builder/nokogiri.rb
Overview
Nokogiri adapter for XSD schema generation Wraps Nokogiri::XML::Builder to provide schema building capabilities
Instance Attribute Summary collapse
-
#builder ⇒ Object
readonly
Returns the value of attribute builder.
Instance Method Summary collapse
-
#initialize(options = {}, &block) ⇒ Nokogiri
constructor
A new instance of Nokogiri.
-
#to_xml(options = {}) ⇒ String
Generate the XSD schema XML string.
Constructor Details
#initialize(options = {}, &block) ⇒ Nokogiri
Returns a new instance of Nokogiri.
14 15 16 17 18 19 20 21 22 |
# File 'lib/lutaml/model/schema/schema_builder/nokogiri.rb', line 14 def initialize( = {}, &block) encoding = [:encoding] || "UTF-8" @builder = if block ::Nokogiri::XML::Builder.new(encoding: encoding, &block) else ::Nokogiri::XML::Builder.new(encoding: encoding) end end |
Instance Attribute Details
#builder ⇒ Object (readonly)
Returns the value of attribute builder.
12 13 14 |
# File 'lib/lutaml/model/schema/schema_builder/nokogiri.rb', line 12 def builder @builder end |
Instance Method Details
#to_xml(options = {}) ⇒ String
Generate the XSD schema XML string
29 30 31 32 33 34 35 36 |
# File 'lib/lutaml/model/schema/schema_builder/nokogiri.rb', line 29 def to_xml( = {}) if [:pretty] indent = [:indent] || 2 builder.to_xml(indent: indent) else builder.to_xml end end |