Class: Jekyll::Page
- Inherits:
-
Object
- Object
- Jekyll::Page
- Defined in:
- lib/jekyll-date-format.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
Returns the value of attribute date.
-
#updated ⇒ Object
Returns the value of attribute updated.
Instance Method Summary collapse
-
#initialize(site, source, dir, name) ⇒ Page
constructor
A new instance of Page.
-
#old_initialize ⇒ Object
Copy the #initialize method to #old_initialize, so we can redefine #initialize.
Constructor Details
#initialize(site, source, dir, name) ⇒ Page
Returns a new instance of Page.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/jekyll-date-format.rb', line 91 def initialize(site, source, dir, name) old_initialize(site, source, dir, name) format = self.site.config['date_format'] unless self.data['date'].nil? date_f = DateFormat.format_date(self.data['date'], format) unless self.data['date'].nil? date_t = DateFormat.time_tag(self.data['date'], date_f, 'published') self.data['date_formatted'] = date_f self.data['time_tag'] = date_t end unless self.data['updated'].nil? updated = Time.parse(self.data['updated'].to_s) updated_f = DateFormat.format_date(self.data['updated'], format) updated_t = DateFormat.time_tag(self.date, date_f, 'updated') self.data['updated'] = updated self.data['updated_formatted'] = updated_f self.data['updated_time_tag'] = updated_t end end |
Instance Attribute Details
#date ⇒ Object
Returns the value of attribute date.
89 90 91 |
# File 'lib/jekyll-date-format.rb', line 89 def date @date end |
#updated ⇒ Object
Returns the value of attribute updated.
89 90 91 |
# File 'lib/jekyll-date-format.rb', line 89 def updated @updated end |
Instance Method Details
#old_initialize ⇒ Object
Copy the #initialize method to #old_initialize, so we can redefine #initialize
88 |
# File 'lib/jekyll-date-format.rb', line 88 alias_method :old_initialize, :initialize |