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)
-
- (Object) label
Returns the value of attribute label.
-
- (Object) view
Returns the value of attribute view.
Instance Method Summary (collapse)
- - (Object) alt
- - (Object) as_html(link_resolver, html_serializer = nil)
- - (Object) copyright
- - (Object) height
-
- (Image) initialize(view, label = nil)
constructor
A new instance of Image.
- - (Object) link_to
- - (Object) url
- - (Object) width
Methods inherited from Prismic::Fragments::StructuredText::Block
Constructor Details
- (Image) initialize(view, label = nil)
Returns a new instance of Image
326 327 328 329 |
# File 'lib/prismic/fragments/structured_text.rb', line 326 def initialize(view, label = nil) @view = view @label = label end |
Instance Attribute Details
- (Object) label
Returns the value of attribute label
324 325 326 |
# File 'lib/prismic/fragments/structured_text.rb', line 324 def label @label end |
- (Object) view
Returns the value of attribute view
324 325 326 |
# File 'lib/prismic/fragments/structured_text.rb', line 324 def view @view end |
Instance Method Details
- (Object) alt
343 344 345 |
# File 'lib/prismic/fragments/structured_text.rb', line 343 def alt @view.alt end |
- (Object) as_html(link_resolver, html_serializer = nil)
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 |
# File 'lib/prismic/fragments/structured_text.rb', line 355 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 |
- (Object) copyright
347 348 349 |
# File 'lib/prismic/fragments/structured_text.rb', line 347 def copyright @view.copyright end |
- (Object) height
339 340 341 |
# File 'lib/prismic/fragments/structured_text.rb', line 339 def height @view.height end |
- (Object) link_to
351 352 353 |
# File 'lib/prismic/fragments/structured_text.rb', line 351 def link_to @view.link_to end |
- (Object) url
331 332 333 |
# File 'lib/prismic/fragments/structured_text.rb', line 331 def url @view.url end |
- (Object) width
335 336 337 |
# File 'lib/prismic/fragments/structured_text.rb', line 335 def width @view.width end |