Sha256: 306e40f2d20edf0d3ca63b48a7f5d6780815b431c15e3e333ca91185bfb61da5
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
# encoding: utf-8 module Prismic module Fragments # A fragment of type Slice, an item in a SliceZone class Slice < Fragment attr_accessor :slice_type attr_accessor :value def initialize(slice_type, value) @slice_type = slice_type @value = value end # Generate an text representation of the group # # @return [String] the text representation def as_text @value.as_text end # 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 def as_html(link_resolver=nil) @value.as_html(link_resolver) end end class SliceZone < Fragment attr_accessor :slices def initialize(slices) @slices = slices end # Generate an text representation of the group # # @return [String] the text representation def as_text @slices.map { |slice| slice.as_text }.join("\n") end # 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 def as_html(link_resolver=nil) @slices.map { |slice| slice.as_html(link_resolver) }.join("\n") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
prismic.io-1.3.0 | lib/prismic/fragments/slices.rb |