Class: Jekyll::Post

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll-date-format.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(site, source, dir, name) ⇒ Post

Returns a new instance of Post.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/jekyll-date-format.rb', line 62

def initialize(site, source, dir, name)
  old_initialize(site, source, dir, name)
  format = self.site.config['date_format']

  date_f = DateFormat.format_date(self.date, format) unless self.data['date'].nil?
  date_t = DateFormat.time_tag(self.date, date_f, 'published')

  self.data['date_formatted'] = date_f
  self.data['time_tag'] = date_t

  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

#updatedObject

Returns the value of attribute updated.



60
61
62
# File 'lib/jekyll-date-format.rb', line 60

def updated
  @updated
end

Instance Method Details

#old_initializeObject

Copy the #initialize method to #old_initialize, so we can redefine #initialize



59
# File 'lib/jekyll-date-format.rb', line 59

alias_method :old_initialize, :initialize