Class: Prismic::Fragments::SliceZone

Inherits:
Fragment
  • Object
show all
Defined in:
lib/prismic/fragments/slices.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(slices) ⇒ SliceZone

Returns a new instance of SliceZone.



91
92
93
# File 'lib/prismic/fragments/slices.rb', line 91

def initialize(slices)
  @slices = slices
end

Instance Attribute Details

#slicesObject

Returns the value of attribute slices.



89
90
91
# File 'lib/prismic/fragments/slices.rb', line 89

def slices
  @slices
end

Instance Method Details

#as_html(link_resolver = nil) ⇒ String

Generate an HTML representation of the group

Parameters:

  • link_resolver (LinkResolver) (defaults to: nil)

    The LinkResolver used to build application's specific URL

Returns:

  • (String)

    the HTML representation



108
109
110
# File 'lib/prismic/fragments/slices.rb', line 108

def as_html(link_resolver=nil)
  @slices.map { |slice| slice.as_html(link_resolver) }.join("\n")
end

#as_textString

Generate an text representation of the group

Returns:

  • (String)

    the text representation



98
99
100
# File 'lib/prismic/fragments/slices.rb', line 98

def as_text
  @slices.map { |slice| slice.as_text }.join("\n")
end