Class: JekyllSupport::APage
- Inherits:
-
Object
- Object
- JekyllSupport::APage
- Defined in:
- lib/hooks/a_page.rb
Overview
Time.new is -4712-01-01
Instance Attribute Summary collapse
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#collection_name ⇒ Object
readonly
Returns the value of attribute collection_name.
-
#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.
-
#last_modified_field ⇒ Object
readonly
Returns the value of attribute last_modified_field.
-
#layout ⇒ Object
readonly
Returns the value of attribute layout.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#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
- #field(name, use_default: true) ⇒ Object
-
#initialize(obj, origin) ⇒ APage
constructor
A new instance of APage.
-
#obj_field(obj, key) ⇒ Object
Look within @data (if the property exists), then self for the given key as a symbol or a string.
- #order ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(obj, origin) ⇒ APage
Returns a new instance of APage.
90 91 92 93 94 95 96 |
# File 'lib/hooks/a_page.rb', line 90 def initialize(obj, origin) @logger = obj.logger @origin = origin build obj rescue StandardError => e ::JekyllSupport.error_short_trace(@logger, e) end |
Instance Attribute Details
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def categories @categories end |
#collection_name ⇒ Object (readonly)
Returns the value of attribute collection_name.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def collection_name @collection_name end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def content @content end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def data @data end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def date @date end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def description @description end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def destination @destination end |
#draft ⇒ Object (readonly)
Returns the value of attribute draft.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def draft @draft end |
#excerpt ⇒ Object (readonly)
Returns the value of attribute excerpt.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def excerpt @excerpt end |
#ext ⇒ Object (readonly)
Returns the value of attribute ext.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def ext @ext end |
#extname ⇒ Object (readonly)
Returns the value of attribute extname.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def extname @extname end |
#href ⇒ Object (readonly)
Returns the value of attribute href.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def href @href end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def label @label end |
#last_modified ⇒ Object (readonly)
Returns the value of attribute last_modified.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def last_modified @last_modified end |
#last_modified_field ⇒ Object (readonly)
Returns the value of attribute last_modified_field.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def last_modified_field @last_modified_field end |
#layout ⇒ Object (readonly)
Returns the value of attribute layout.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def layout @layout end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def logger @logger end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def name @name end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def origin @origin end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def path @path end |
#relative_path ⇒ Object (readonly)
Returns the value of attribute relative_path.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def relative_path @relative_path end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def @tags end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def type @type end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
83 84 85 |
# File 'lib/hooks/a_page.rb', line 83 def url @url end |
Instance Method Details
#field(name, use_default: true) ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/hooks/a_page.rb', line 99 def field(name, use_default: true) default_value = case name when :date, :last_modified, :last_modified_at END_OF_DAYS else '' end result = data[name.to_sym] || data[name.to_s] if data.key?(name.to_sym) || data.key?(name.to_s) return result if result default_value if use_default end |
#obj_field(obj, key) ⇒ Object
Look within @data (if the property exists), then self for the given key as a symbol or a string
116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/hooks/a_page.rb', line 116 def obj_field(obj, key) if obj.respond_to? :data return obj.data[key] if obj.data.key? key return obj.data[key.to_s] if obj.data.key? key.to_s end return obj.send(key) if obj.respond_to?(key) return unless obj.respond_to?(:key?) return obj[key] if obj.key?(key) obj[key.to_s] if obj.key?(key.to_s) end |
#order ⇒ Object
130 131 132 133 134 135 136 |
# File 'lib/hooks/a_page.rb', line 130 def order if data.key?('order') || data.key?(:order) data['order'] || data[:order] else FIXNUM_MAX end end |
#to_s ⇒ Object
138 139 140 |
# File 'lib/hooks/a_page.rb', line 138 def to_s @label || @date.to_s end |