Class: OpenStax::Cnx::V1::KeyTerm
- Defined in:
- lib/openstax/cnx/v1/key_term.rb
Constant Summary collapse
- MATCH_KEY_TERM =
"//*[contains(@class, 'os-glossary-container')]//dl"- MATCH_KEY_TERM_TEXT =
".//dt"- MATCH_KEY_TERM_DESCRIPTION =
".//dd"
Instance Attribute Summary
Attributes inherited from Element
Class Method Summary collapse
Instance Method Summary collapse
- #description ⇒ Object
- #id ⇒ Object
-
#initialize(node:) ⇒ KeyTerm
constructor
A new instance of KeyTerm.
- #term ⇒ Object
Constructor Details
#initialize(node:) ⇒ KeyTerm
Returns a new instance of KeyTerm.
8 9 10 |
# File 'lib/openstax/cnx/v1/key_term.rb', line 8 def initialize(node:) super end |
Class Method Details
.matcher ⇒ Object
24 25 26 |
# File 'lib/openstax/cnx/v1/key_term.rb', line 24 def self.matcher MATCH_KEY_TERM end |
.matches?(node) ⇒ Boolean
28 29 30 |
# File 'lib/openstax/cnx/v1/key_term.rb', line 28 def self.matches?(node) node.matches?(MATCH_KEY_TERM) end |
Instance Method Details
#description ⇒ Object
12 13 14 |
# File 'lib/openstax/cnx/v1/key_term.rb', line 12 def description node.xpath(MATCH_KEY_TERM_DESCRIPTION).text end |
#id ⇒ Object
16 17 18 |
# File 'lib/openstax/cnx/v1/key_term.rb', line 16 def id node.attr('id') end |
#term ⇒ Object
20 21 22 |
# File 'lib/openstax/cnx/v1/key_term.rb', line 20 def term node.xpath(MATCH_KEY_TERM_TEXT).text end |