Class: Rtml::Rules::DomTag
- Inherits:
-
Object
- Object
- Rtml::Rules::DomTag
- Defined in:
- lib/rtml/rules/dom_tag.rb
Instance Attribute Summary collapse
-
#child_tags ⇒ Object
readonly
Returns the value of attribute child_tags.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
Instance Method Summary collapse
- #==(a) ⇒ Object
- #children ⇒ Object
-
#first ⇒ Object
compatiblity with Array; see Tml::Dom::Ruleset.
-
#initialize(name) ⇒ DomTag
constructor
A new instance of DomTag.
- #maximum(child_name) ⇒ Object
- #minimum(child_name) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name) ⇒ DomTag
Returns a new instance of DomTag.
6 7 8 9 10 |
# File 'lib/rtml/rules/dom_tag.rb', line 6 def initialize(name) @name = name @child_tags = [] @order = [] end |
Instance Attribute Details
#child_tags ⇒ Object (readonly)
Returns the value of attribute child_tags.
3 4 5 |
# File 'lib/rtml/rules/dom_tag.rb', line 3 def @child_tags end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/rtml/rules/dom_tag.rb', line 2 def name @name end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
4 5 6 |
# File 'lib/rtml/rules/dom_tag.rb', line 4 def order @order end |
Instance Method Details
#==(a) ⇒ Object
24 25 26 |
# File 'lib/rtml/rules/dom_tag.rb', line 24 def ==(a) a.kind_of?(String) ? a == name : a.name == name end |
#children ⇒ Object
12 13 14 |
# File 'lib/rtml/rules/dom_tag.rb', line 12 def children .flatten.select { |t| t.kind_of?(String) } end |
#first ⇒ Object
compatiblity with Array; see Tml::Dom::Ruleset
20 21 22 |
# File 'lib/rtml/rules/dom_tag.rb', line 20 def first self end |
#maximum(child_name) ⇒ Object
17 |
# File 'lib/rtml/rules/dom_tag.rb', line 17 def maximum(child_name) option_for_child(child_name, :maximum) end |
#minimum(child_name) ⇒ Object
16 |
# File 'lib/rtml/rules/dom_tag.rb', line 16 def minimum(child_name) option_for_child(child_name, :minimum) end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/rtml/rules/dom_tag.rb', line 28 def to_s name end |