Class: Lutaml::Xml::Decisions::DecisionRule Abstract
- Inherits:
-
Object
- Object
- Lutaml::Xml::Decisions::DecisionRule
- Defined in:
- lib/lutaml/xml/decisions/decision_rule.rb
Overview
Direct Known Subclasses
Rules::AttributeUsageRule, Rules::DefaultPreferenceRule, Rules::ElementFormDefaultRule, Rules::ElementFormDefaultUnqualifiedRule, Rules::ElementFormOptionRule, Rules::ExplicitOptionRule, Rules::FormatPreservationRule, Rules::HoistedOnParentRule, Rules::InheritFromParentRule, Rules::InheritParentPrefixRule, Rules::NamespaceScopeRule, Rules::ReuseParentPrefixRule, Rules::UsedPrefixRule
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer
Compare rules by priority (for sorting).
-
#applies?(context) ⇒ Boolean
Check if this rule applies to the given context.
-
#decide(context) ⇒ Decision
Make the decision for this rule.
-
#name ⇒ String
Human-readable name of this rule.
-
#priority ⇒ Integer
Get the priority of this rule (lower = higher priority).
Instance Method Details
#<=>(other) ⇒ Integer
Compare rules by priority (for sorting)
48 49 50 |
# File 'lib/lutaml/xml/decisions/decision_rule.rb', line 48 def <=>(other) priority <=> other.priority end |
#applies?(context) ⇒ Boolean
Check if this rule applies to the given context
18 19 20 |
# File 'lib/lutaml/xml/decisions/decision_rule.rb', line 18 def applies?(context) raise NotImplementedError, "#{self.class} must implement #applies?" end |
#decide(context) ⇒ Decision
Make the decision for this rule
26 27 28 |
# File 'lib/lutaml/xml/decisions/decision_rule.rb', line 26 def decide(context) raise NotImplementedError, "#{self.class} must implement #decide" end |
#name ⇒ String
Human-readable name of this rule
40 41 42 |
# File 'lib/lutaml/xml/decisions/decision_rule.rb', line 40 def name self.class.name.split("::").last end |
#priority ⇒ Integer
Get the priority of this rule (lower = higher priority)
33 34 35 |
# File 'lib/lutaml/xml/decisions/decision_rule.rb', line 33 def priority raise NotImplementedError, "#{self.class} must implement #priority" end |