Class: Prismic::Document
- Inherits:
-
Object
show all
- Includes:
- WithFragments
- Defined in:
- lib/prismic.rb
Instance Attribute Summary (collapse)
Instance Method Summary
(collapse)
#[], #as_html, #as_text, #each, #first_title, #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
- (Document) initialize(id, uid, type, href, tags, slugs, fragments)
Returns a new instance of Document
456
457
458
459
460
461
462
463
464
|
# File 'lib/prismic.rb', line 456
def initialize(id, uid, type, href, tags, slugs, fragments)
@id = id
@uid = uid
@type = type
@href = href
@tags = tags
@slugs = slugs
@fragments = fragments
end
|
Instance Attribute Details
- (Array<Fragment>) fragments
454
455
456
|
# File 'lib/prismic.rb', line 454
def fragments
@fragments
end
|
- (String) href
448
449
450
|
# File 'lib/prismic.rb', line 448
def href
@href
end
|
- (String) id
442
443
444
|
# File 'lib/prismic.rb', line 442
def id
@id
end
|
- (Array<String>) slugs
452
453
454
|
# File 'lib/prismic.rb', line 452
def slugs
@slugs
end
|
450
451
452
|
# File 'lib/prismic.rb', line 450
def tags
@tags
end
|
- (String) type
446
447
448
|
# File 'lib/prismic.rb', line 446
def type
@type
end
|
- (String) uid
444
445
446
|
# File 'lib/prismic.rb', line 444
def uid
@uid
end
|
Instance Method Details
- (String) slug
Returns the document's slug
469
470
471
|
# File 'lib/prismic.rb', line 469
def slug
slugs.empty? ? '-' : slugs.first
end
|