Class: Prismic::Document
Instance Attribute Summary collapse
Instance Method Summary
collapse
-
#initialize(id, uid, type, href, tags, slugs, first_publication_date, last_publication_date, lang, alternate_languages, fragments) ⇒ Document
constructor
A new instance of Document.
-
#slug ⇒ String
Returns the document's slug.
#[], #as_html, #as_text, #each, #first_title, #get_boolean_field, #get_color, #get_date, #get_embed, #get_geopoint, #get_group, #get_image, #get_link, #get_number, #get_slice_zone, #get_structured_text, #get_text, #get_timestamp, #length, #linked_documents
Constructor Details
#initialize(id, uid, type, href, tags, slugs, first_publication_date, last_publication_date, lang, alternate_languages, fragments) ⇒ Document
Returns a new instance of Document.
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
|
# File 'lib/prismic.rb', line 478
def initialize(
id,
uid,
type,
href,
tags,
slugs,
first_publication_date,
last_publication_date,
lang,
alternate_languages,
fragments
)
@id = id
@uid = uid
@type = type
@href = href
@tags = tags
@slugs = slugs
@first_publication_date = first_publication_date
@last_publication_date = last_publication_date
@lang = lang
@alternate_languages = alternate_languages
@fragments = fragments
end
|
Instance Attribute Details
474
475
476
|
# File 'lib/prismic.rb', line 474
def alternate_languages
@alternate_languages
end
|
#first_publication_date ⇒ Object
468
469
470
|
# File 'lib/prismic.rb', line 468
def first_publication_date
@first_publication_date
end
|
#fragments ⇒ Array<Fragment>
476
477
478
|
# File 'lib/prismic.rb', line 476
def fragments
@fragments
end
|
#href ⇒ String
462
463
464
|
# File 'lib/prismic.rb', line 462
def href
@href
end
|
#id ⇒ String
456
457
458
|
# File 'lib/prismic.rb', line 456
def id
@id
end
|
#lang ⇒ String
472
473
474
|
# File 'lib/prismic.rb', line 472
def lang
@lang
end
|
#last_publication_date ⇒ Object
470
471
472
|
# File 'lib/prismic.rb', line 470
def last_publication_date
@last_publication_date
end
|
#slugs ⇒ Array<String>
466
467
468
|
# File 'lib/prismic.rb', line 466
def slugs
@slugs
end
|
464
465
466
|
# File 'lib/prismic.rb', line 464
def tags
@tags
end
|
#type ⇒ String
460
461
462
|
# File 'lib/prismic.rb', line 460
def type
@type
end
|
#uid ⇒ String
458
459
460
|
# File 'lib/prismic.rb', line 458
def uid
@uid
end
|
Instance Method Details
#slug ⇒ String
Returns the document's slug
507
508
509
|
# File 'lib/prismic.rb', line 507
def slug
slugs.empty? ? '-' : slugs.first
end
|