Class: SolidusSeo::Jsonld::Base
- Inherits:
-
Object
- Object
- SolidusSeo::Jsonld::Base
- Includes:
- ActionView::Helpers::JavaScriptHelper, ActionView::Helpers::TagHelper
- Defined in:
- lib/solidus_seo/jsonld/base.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(data) ⇒ Base
constructor
A new instance of Base.
- #print(only: nil, exclude: nil) ⇒ Object
Constructor Details
#initialize(data) ⇒ Base
Returns a new instance of Base.
7 8 9 10 |
# File 'lib/solidus_seo/jsonld/base.rb', line 7 def initialize(data) @data = data parse end |
Instance Method Details
#print(only: nil, exclude: nil) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/solidus_seo/jsonld/base.rb', line 12 def print(only: nil, exclude: nil) return if data.blank? output = filter(only: only, exclude: exclude) javascript_tag(JSON.pretty_generate(output), type: 'application/ld+json').html_safe end |