Class: Celerity::Identifier
- Inherits:
- Object
- Defined in:
- lib/celerity/identifier.rb
Attribute Summary
- - (Object) attributes readonly Returns the value of attribute attributes.
- - (Object) tag readonly Returns the value of attribute tag.
- - (Object) text Returns the value of attribute text.
Method Summary
- - (Identifier) initialize(tag, attributes = {}) A new instance of Identifier.
- - (Object) match?(element)
Constructor Details
- (Identifier) initialize(tag, attributes = {})
A new instance of Identifier
7 8 9 10 11 |
# File 'lib/celerity/identifier.rb', line 7 def initialize(tag, attributes = {}) @tag = tag @attributes = attributes @text = nil end |
Attribute Details
- (Object) attributes (readonly)
Returns the value of attribute attributes
5 6 7 |
# File 'lib/celerity/identifier.rb', line 5 def attributes @attributes end |
- (Object) tag (readonly)
Returns the value of attribute tag
5 6 7 |
# File 'lib/celerity/identifier.rb', line 5 def tag @tag end |
- (Object) text
Returns the value of attribute text
4 5 6 |
# File 'lib/celerity/identifier.rb', line 4 def text @text end |
Method Details
- (Object) match?(element)
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/celerity/identifier.rb', line 13 def match?(element) return false unless @tag == element.getTagName attr_result = @attributes.all? do |key, values| values.any? { |val| Util.matches?(element.getAttribute(key.to_s), val) } end if @text attr_result && Util.matches?(element.asText.strip, @text) else attr_result end end |