Class: DocWrapper::InnerHtmlPropertyDefinition
- Inherits:
-
BasePropertyDefinition
- Object
- BasePropertyDefinition
- DocWrapper::InnerHtmlPropertyDefinition
- Defined in:
- lib/doc_wrapper/inner_html_property_definition.rb
Direct Known Subclasses
BooleanPropertyDefinition, DatePropertyDefinition, FloatPropertyDefinition, StringPropertyDefinition, TimePropertyDefinition
Instance Attribute Summary
Attributes inherited from BasePropertyDefinition
#block, #options, #property_name, #selector, #type
Instance Method Summary collapse
Methods inherited from BasePropertyDefinition
Constructor Details
This class inherits a constructor from DocWrapper::BasePropertyDefinition
Instance Method Details
#get_nodes(documents) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/doc_wrapper/inner_html_property_definition.rb', line 15 def get_nodes (documents) if [:namespaces] documents[@options[:document] - 1].xpath(@selector, [:namespaces]) else begin documents[@options[:document] - 1].search(@selector) rescue Nokogiri::CSS::SyntaxError documents[@options[:document] - 1].xpath(@selector) end end end |
#property(documents) ⇒ Object
3 4 5 |
# File 'lib/doc_wrapper/inner_html_property_definition.rb', line 3 def property (documents) transform(raw_property(documents)) end |
#raw_property(documents) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/doc_wrapper/inner_html_property_definition.rb', line 7 def raw_property (documents) if [:use_attribute] get_nodes(documents).first[[:use_attribute]] else get_nodes(documents).inner_html.strip end end |