Class: Prismic::Fragments::StructuredText::Block::Image
- Inherits:
-
Prismic::Fragments::StructuredText::Block
- Object
- Prismic::Fragments::StructuredText::Block
- Prismic::Fragments::StructuredText::Block::Image
- Defined in:
- lib/prismic/fragments/structured_text.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
Returns the value of attribute label.
-
#view ⇒ Object
Returns the value of attribute view.
Instance Method Summary collapse
- #alt ⇒ Object
- #as_html(link_resolver, html_serializer = nil) ⇒ Object
- #copyright ⇒ Object
- #height ⇒ Object
-
#initialize(view, label = nil) ⇒ Image
constructor
A new instance of Image.
- #link_to ⇒ Object
- #url ⇒ Object
- #width ⇒ Object
Methods inherited from Prismic::Fragments::StructuredText::Block
Constructor Details
#initialize(view, label = nil) ⇒ Image
Returns a new instance of Image.
328 329 330 331 |
# File 'lib/prismic/fragments/structured_text.rb', line 328 def initialize(view, label = nil) @view = view @label = label end |
Instance Attribute Details
#label ⇒ Object
Returns the value of attribute label.
326 327 328 |
# File 'lib/prismic/fragments/structured_text.rb', line 326 def label @label end |
#view ⇒ Object
Returns the value of attribute view.
326 327 328 |
# File 'lib/prismic/fragments/structured_text.rb', line 326 def view @view end |
Instance Method Details
#alt ⇒ Object
345 346 347 |
# File 'lib/prismic/fragments/structured_text.rb', line 345 def alt @view.alt end |
#as_html(link_resolver, html_serializer = nil) ⇒ Object
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
# File 'lib/prismic/fragments/structured_text.rb', line 357 def as_html(link_resolver, html_serializer = nil) custom = nil unless html_serializer.nil? custom = html_serializer.serialize(self, '') end if custom.nil? classes = ['block-img'] unless @label.nil? classes.push(@label) end %(<p class="#{classes.join(' ')}">#{view.as_html(link_resolver)}</p>) else custom end end |
#copyright ⇒ Object
349 350 351 |
# File 'lib/prismic/fragments/structured_text.rb', line 349 def copyright @view.copyright end |
#height ⇒ Object
341 342 343 |
# File 'lib/prismic/fragments/structured_text.rb', line 341 def height @view.height end |
#link_to ⇒ Object
353 354 355 |
# File 'lib/prismic/fragments/structured_text.rb', line 353 def link_to @view.link_to end |
#url ⇒ Object
333 334 335 |
# File 'lib/prismic/fragments/structured_text.rb', line 333 def url @view.url end |
#width ⇒ Object
337 338 339 |
# File 'lib/prismic/fragments/structured_text.rb', line 337 def width @view.width end |