Class: MetaHari::Helpers::JsonLd

Inherits:
Object
  • Object
show all
Defined in:
lib/meta_hari/helpers/json_ld.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#documentObject (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