class Prismic::Fragments::SimpleSlice
A fragment of type SimpleSlice
, an item in a SliceZone
Attributes
slice_label[RW]
slice_type[RW]
value[RW]
Public Class Methods
new(slice_type, slice_label, value)
click to toggle source
# File lib/prismic/fragments/slices.rb, line 60 def initialize(slice_type, slice_label, value) @slice_type = slice_type @slice_label = slice_label @value = value end
Public Instance Methods
as_html(link_resolver=nil)
click to toggle source
Generate an HTML representation of the group
@param link_resolver [LinkResolver] The LinkResolver
used to build
application's specific URL
@return [String] the HTML representation
# File lib/prismic/fragments/slices.rb, line 79 def as_html(link_resolver=nil) classes = ['slice'] unless (@slice_label.nil?) classes.push(@slice_label) end %[<div data-slicetype="#{@slice_type}" class="#{classes.join(' ')}">#{@value.as_html(link_resolver)}</div>] end
as_text()
click to toggle source
Generate an text representation of the group
@return [String] the text representation
# File lib/prismic/fragments/slices.rb, line 69 def as_text @value.as_text end