Class: MetaHari::Helpers::JsonLd
- Inherits:
-
Object
- Object
- MetaHari::Helpers::JsonLd
- Defined in:
- lib/meta_hari/helpers/json_ld.rb
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
Instance Method Summary collapse
- #data(type = 'Product') ⇒ Object
-
#initialize(document) ⇒ JsonLd
constructor
A new instance of JsonLd.
Constructor Details
#initialize(document) ⇒ JsonLd
Returns a new instance of JsonLd.
6 7 8 |
# File 'lib/meta_hari/helpers/json_ld.rb', line 6 def initialize(document) @document = document end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
4 5 6 |
# File 'lib/meta_hari/helpers/json_ld.rb', line 4 def document @document end |
Instance Method Details
#data(type = 'Product') ⇒ Object
10 11 12 |
# File 'lib/meta_hari/helpers/json_ld.rb', line 10 def data(type = 'Product') (json['@type'] == type) ? json : {} end |