Class: Duxml::AttrsRuleClass

Inherits:
RuleClass show all
Includes:
AttrsRule, RngAttrsRule
Defined in:
lib/duxml/meta/grammar/rule/attrs_rule.rb,
lib/duxml/meta/grammar/relax_ng/attrs_rule.rb

Overview

do not subclass this! as object, consists of subject and a Regexp describing allowable attribute names as well as a String indicating with DTD symbols for whether the given attributes are allowed or required

Instance Attribute Summary collapse

Attributes inherited from RuleClass

#object, #statement

Attributes included from Reportable

#observer_peers

Attributes inherited from PatternClass

#subject

Attributes included from Duxml

#doc

Attributes included from Saxer

#io

Instance Method Summary collapse

Methods included from RngAttrsRule

#relaxng

Methods included from LazyOx

#method_missing

Methods included from AttrsRule

#applies_to?, #attr_name, #description, #pass, #qualify, #relationship, #required?

Methods included from Rule

#applies_to?, #description, #history, #qualify

Methods included from Reportable

#add_observer

Methods included from Pattern

#<=>, #abstract?, #concrete?, #description, #name, #object, #relationship, #simple_name, #xml

Methods included from Duxml

#load, #log, #save, #validate

Methods included from Saxer

#sax

Constructor Details

#initialize(_subject, attrs, required = '#IMPLIED') ⇒ AttrsRuleClass

Returns a new instance of AttrsRuleClass.

Parameters:

  • _subject (String)

    name of the Element

  • attrs (String)

    the attribute name pattern in Regexp form

  • required (String) (defaults to: '#IMPLIED')

    the requirement level - optional i.e. #IMPLIED by default



17
18
19
20
21
# File 'lib/duxml/meta/grammar/rule/attrs_rule.rb', line 17

def initialize(_subject, attrs, required='#IMPLIED')
  formatted_statement = attrs.gsub('-', '__dash__').gsub(/\b/, '\b').gsub('-', '__dash__')
  @requirement = required
  super(_subject, formatted_statement)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Duxml::LazyOx

Instance Attribute Details

#requirementObject (readonly)

Returns the value of attribute requirement.



23
24
25
# File 'lib/duxml/meta/grammar/rule/attrs_rule.rb', line 23

def requirement
  @requirement
end