Class: PrismicRails::Fragment
- Inherits:
-
Object
- Object
- PrismicRails::Fragment
- Defined in:
- lib/prismic_rails/content/fragment.rb
Overview
The PrismicRails::Fragment is a wrapper class around Prismic::Fragment
Instance Attribute Summary collapse
-
#fragment ⇒ Object
readonly
Returns the value of attribute fragment.
Instance Method Summary collapse
-
#as_html(serializer = nil) ⇒ Object
Returns the document as safe html.
-
#as_text ⇒ Object
Returns only the text of a document.
-
#initialize(fragment) ⇒ Fragment
constructor
Create a new instance of PrismicRails::Fragment
fragment
A Prismic::Fragment.
Constructor Details
#initialize(fragment) ⇒ Fragment
Create a new instance of PrismicRails::Fragment
+fragment+ A Prismic::Fragment
9 10 11 |
# File 'lib/prismic_rails/content/fragment.rb', line 9 def initialize(fragment) @fragment = fragment end |
Instance Attribute Details
#fragment ⇒ Object (readonly)
Returns the value of attribute fragment.
5 6 7 |
# File 'lib/prismic_rails/content/fragment.rb', line 5 def fragment @fragment end |
Instance Method Details
#as_html(serializer = nil) ⇒ Object
Returns the document as safe html
14 15 16 |
# File 'lib/prismic_rails/content/fragment.rb', line 14 def as_html(serializer = nil) @fragment.as_html(serializer) end |
#as_text ⇒ Object
Returns only the text of a document
19 20 21 |
# File 'lib/prismic_rails/content/fragment.rb', line 19 def as_text @fragment.as_text end |