Class: AllCollectionsHooks::APage
- Inherits:
-
Object
- Object
- AllCollectionsHooks::APage
- Defined in:
- lib/hooks/a_page.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#draft ⇒ Object
readonly
Returns the value of attribute draft.
-
#excerpt ⇒ Object
readonly
Returns the value of attribute excerpt.
-
#ext ⇒ Object
readonly
Returns the value of attribute ext.
-
#extname ⇒ Object
readonly
Returns the value of attribute extname.
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#last_modified ⇒ Object
readonly
Returns the value of attribute last_modified.
-
#layout ⇒ Object
readonly
Returns the value of attribute layout.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#relative_path ⇒ Object
readonly
Returns the value of attribute relative_path.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(obj, origin) ⇒ APage
constructor
A new instance of APage.
- #to_s ⇒ Object
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
#content ⇒ Object (readonly)
Returns the value of attribute content.
3 4 5 |
# File 'lib/hooks/a_page.rb', line 3 def content @content end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/hooks/a_page.rb', line 3 def data @data end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
3 4 5 |
# File 'lib/hooks/a_page.rb', line 3 def date @date end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/hooks/a_page.rb', line 3 def description @description end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
3 4 5 |
# File 'lib/hooks/a_page.rb', line 3 def destination @destination end |
#draft ⇒ Object (readonly)
Returns the value of attribute draft.
3 4 5 |
# File 'lib/hooks/a_page.rb', line 3 def draft @draft end |
#excerpt ⇒ Object (readonly)
Returns the value of attribute excerpt.
3 4 5 |
# File 'lib/hooks/a_page.rb', line 3 def excerpt @excerpt end |
#ext ⇒ Object (readonly)
Returns the value of attribute ext.
3 4 5 |
# File 'lib/hooks/a_page.rb', line 3 def ext @ext end |
#extname ⇒ Object (readonly)
Returns the value of attribute extname.
3 4 5 |
# File 'lib/hooks/a_page.rb', line 3 def extname @extname end |
#href ⇒ Object (readonly)
Returns the value of attribute href.
3 4 5 |
# File 'lib/hooks/a_page.rb', line 3 def href @href end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
3 4 5 |
# File 'lib/hooks/a_page.rb', line 3 def label @label end |
#last_modified ⇒ Object (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 |
#layout ⇒ Object (readonly)
Returns the value of attribute layout.
3 4 5 |
# File 'lib/hooks/a_page.rb', line 3 def layout @layout end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
3 4 5 |
# File 'lib/hooks/a_page.rb', line 3 def origin @origin end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/hooks/a_page.rb', line 3 def path @path end |
#relative_path ⇒ Object (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 |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
3 4 5 |
# File 'lib/hooks/a_page.rb', line 3 def end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/hooks/a_page.rb', line 3 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/hooks/a_page.rb', line 3 def type @type end |
#url ⇒ Object (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_s ⇒ Object
27 28 29 |
# File 'lib/hooks/a_page.rb', line 27 def to_s @label || @date.to_s end |