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
119 120 121 122 123 |
# File 'lib/spree/testing_support/microdata.rb', line 119 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’
113 114 115 |
# File 'lib/spree/testing_support/microdata.rb', line 113 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
130 131 132 |
# File 'lib/spree/testing_support/microdata.rb', line 130 def self.parse(element, page_url = nil) new(element, page_url).properties end |