Class: Spree::TestingSupport::Microdata::Itemprop
- Inherits:
-
Object
- Object
- Spree::TestingSupport::Microdata::Itemprop
- Defined in:
- lib/spree/testing_support/microdata.rb
Constant Summary collapse
- NON_TEXTCONTENT_ELEMENTS =
{ 'a' => 'href', 'area' => 'href', 'audio' => 'src', 'embed' => 'src', 'iframe' => 'src', 'img' => 'src', 'link' => 'href', 'meta' => 'content', 'object' => 'data', 'source' => 'src', 'time' => 'datetime', 'track' => 'src', 'video' => 'src' }.freeze
- URL_ATTRIBUTES =
['data', 'href', 'src'].freeze
Instance Attribute Summary collapse
-
#properties ⇒ Object
readonly
A Hash representing the properties.
Class Method Summary collapse
-
.parse(element, page_url = nil) ⇒ Object
Parse the element and return a hash representing the properties.
Instance Method Summary collapse
-
#initialize(element, page_url = nil) ⇒ Itemprop
constructor
Create a new Itemprop object [element] The itemprop element to be parsed [page_url] The url of the page, including filename, used to form absolute urls.
Constructor Details
#initialize(element, page_url = nil) ⇒ Itemprop
Create a new Itemprop object
- element
-
The itemprop element to be parsed
- page_url
-
The url of the page, including filename, used to form absolute urls
122 123 124 125 126 |
# File 'lib/spree/testing_support/microdata.rb', line 122 def initialize(element, page_url = nil) @element = element @page_url = page_url @properties = extract_properties end |
Instance Attribute Details
#properties ⇒ Object (readonly)
A Hash representing the properties. Hash is of the form name’ => ‘value’
116 117 118 |
# File 'lib/spree/testing_support/microdata.rb', line 116 def properties @properties end |
Class Method Details
.parse(element, page_url = nil) ⇒ Object
Parse the element and return a hash representing the properties. Hash is of the form name’ => ‘value’
- element
-
The itemprop element to be parsed
- page_url
-
The url of the page, including filename, used to form absolute urls
133 134 135 |
# File 'lib/spree/testing_support/microdata.rb', line 133 def self.parse(element, page_url = nil) new(element, page_url).properties end |