Module: Duxml::ValueRule
- Included in:
- ValueRuleClass
- Defined in:
- lib/duxml/meta/grammar/rule/value_rule.rb,
lib/duxml/meta/grammar/rule/value_rule.rb
Constant Summary collapse
- CDATA_EXPR =
/(\]\]>)/- ENTITY_EXPR =
/(\b[\S]+\b)/- ID_EXPR =
Regexp.nmtoken
- NMTOKEN_EXPR =
ID_EXPR- NOTATION_EXPR =
//
Instance Method Summary collapse
- #abstract? ⇒ true
-
#applies_to?(change_or_pattern) ⇒ Boolean
Whether this rule does in fact apply.
-
#description ⇒ String
Description of this rule.
-
#qualify(change_or_pattern) ⇒ Boolean
Whether change_or_pattern#subject is allowed to have value of type #object if false, reports Error to History.
Instance Method Details
#abstract? ⇒ true
29 30 31 |
# File 'lib/duxml/meta/grammar/rule/value_rule.rb', line 29 def abstract? true end |
#applies_to?(change_or_pattern) ⇒ Boolean
Returns whether this rule does in fact apply.
52 53 54 55 56 |
# File 'lib/duxml/meta/grammar/rule/value_rule.rb', line 52 def applies_to?(change_or_pattern) return false unless change_or_pattern.respond_to?(:attr_name) return false unless change_or_pattern.respond_to?(:value) change_or_pattern.attr_name == attr_name end |
#description ⇒ String
Returns description of this rule.
34 35 36 |
# File 'lib/duxml/meta/grammar/rule/value_rule.rb', line 34 def description %(#{relationship.capitalize} Rule that @#{attr_name}'s #{relationship} must match '#{statement}') end |
#qualify(change_or_pattern) ⇒ Boolean
Returns whether change_or_pattern#subject is allowed to have value of type #object if false, reports Error to History.
41 42 43 44 45 46 47 48 |
# File 'lib/duxml/meta/grammar/rule/value_rule.rb', line 41 def qualify(change_or_pattern) value = change_or_pattern.value s = change_or_pattern.subject raise Exception if value.nil? result = pass value super change_or_pattern unless result result end |