class Nokogiri::XML::Schematron::Rule

The internal representation of the +<sch:rule>+ XML element.

For example:

rule = Nokogiri::XML::Schematron::Rule.new(nil, id: "rule1", context: "//ex:Example")
# => #<Nokogiri::XML::Schematron::Rule:0x00007fa1fb9e8410 @parent=nil, @children=[], @options={:id=>"rule1", :context=>"//ex:Example"}>
rule.to_builder.to_xml
# => "<?xml version=\"1.0\"?>\n<sch:rule xmlns:sch=\"http://purl.oclc.org/dsdl/schematron\" id=\"rule1\" context=\"//ex:Example\"/>\n"

Protected Instance Methods

build!(xml) click to toggle source
Calls superclass method Nokogiri::XML::Schematron::Base#build!
# File lib/nokogiri/xml/schematron/rule.rb, line 37
def build!(xml)
  xml["sch"].send(:rule, %w(id context).inject(xmlns) { |acc, method_name|
    unless (s = send(method_name.to_sym)).nil?
      acc[method_name.to_s] = s
    end

    acc
  }) do
    super(xml)
  end

  return
end