Class: Prismic::Fragments::Date

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Fragment

#as_text

Constructor Details

#initialize(value) ⇒ Date

Returns a new instance of Date.



7
8
9
# File 'lib/prismic/fragments/date.rb', line 7

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/prismic/fragments/date.rb', line 5

def value
  @value
end

Instance Method Details

#as_html(link_resolver = nil) ⇒ String

Generate an HTML representation of the fragment

Parameters:

  • link_resolver (LinkResolver) (defaults to: nil)

    The LinkResolver used to build application's specific URL

Returns:

  • (String)

    the HTML representation



17
18
19
# File 'lib/prismic/fragments/date.rb', line 17

def as_html(link_resolver=nil)
  %(<time>#{value.iso8601(3)}</time>)
end