Class: AllCollectionsHooks::APage

Inherits:
Object
  • Object
show all
Defined in:
lib/hooks/a_page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(obj, origin) ⇒ APage

Returns a new instance of APage.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/hooks/a_page.rb', line 6

def initialize(obj, origin)
  @origin = origin
  data_field_init obj
  obj_field_init obj
  @draft = Jekyll::Draft.draft? obj
  @href = @url if @href.nil?
  # @href = "/#{@href}" if @origin == 'individual_page'
  @href = "#{@href}index.html" if @href.end_with? '/'
  @name = File.basename(@href)
  @title = if @data&.key?('title')
             @data['title']
           elsif obj.respond_to?(:title)
             obj.title
           else
             "<code>#{@href}</code>"
           end
rescue StandardError => e
  JekyllSupport.error_short_trace(@logger, e)
  # JekyllSupport.warn_short_trace(@logger, e)
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def content
  @content
end

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def data
  @data
end

#dateObject (readonly)

Returns the value of attribute date.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def date
  @date
end

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def description
  @description
end

#destinationObject (readonly)

Returns the value of attribute destination.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def destination
  @destination
end

#draftObject (readonly)

Returns the value of attribute draft.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def draft
  @draft
end

#excerptObject (readonly)

Returns the value of attribute excerpt.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def excerpt
  @excerpt
end

#extObject (readonly)

Returns the value of attribute ext.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def ext
  @ext
end

#extnameObject (readonly)

Returns the value of attribute extname.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def extname
  @extname
end

#hrefObject (readonly)

Returns the value of attribute href.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def href
  @href
end

#labelObject (readonly)

Returns the value of attribute label.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def label
  @label
end

#last_modifiedObject (readonly)

Returns the value of attribute last_modified.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def last_modified
  @last_modified
end

#layoutObject (readonly)

Returns the value of attribute layout.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def layout
  @layout
end

#originObject (readonly)

Returns the value of attribute origin.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def origin
  @origin
end

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def path
  @path
end

#relative_pathObject (readonly)

Returns the value of attribute relative_path.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def relative_path
  @relative_path
end

#tagsObject (readonly)

Returns the value of attribute tags.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def tags
  @tags
end

#titleObject (readonly)

Returns the value of attribute title.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def title
  @title
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def type
  @type
end

#urlObject (readonly)

Returns the value of attribute url.



3
4
5
# File 'lib/hooks/a_page.rb', line 3

def url
  @url
end

Instance Method Details

#to_sObject



27
28
29
# File 'lib/hooks/a_page.rb', line 27

def to_s
  @label || @date.to_s
end