Class: Jekyll::Drops::UrlDrop

Inherits:
Drop
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/jekyll/drops/url_drop.rb

Constant Summary

Constants inherited from Drop

Drop::NON_CONTENT_METHODS

Instance Method Summary collapse

Methods inherited from Drop

#[], #[]=, #content_methods, #each, #each_key, #hash_for_json, #initialize, #inspect, #key?, #keys, #merge, #merge!, mutable, mutable?, #to_h, #to_json

Constructor Details

This class inherits a constructor from Jekyll::Drops::Drop

Instance Method Details

#categoriesObject



30
31
32
33
34
35
36
# File 'lib/jekyll/drops/url_drop.rb', line 30

def categories
  category_set = Set.new
  Array(@obj.data['categories']).each do |category|
    category_set << category.to_s.downcase
  end
  category_set.to_a.join('/')
end

#collectionObject



13
14
15
# File 'lib/jekyll/drops/url_drop.rb', line 13

def collection
  @obj.collection.label
end

#dayObject



46
47
48
# File 'lib/jekyll/drops/url_drop.rb', line 46

def day
  @obj.date.strftime("%d")
end

#hourObject



50
51
52
# File 'lib/jekyll/drops/url_drop.rb', line 50

def hour
  @obj.date.strftime("%H")
end

#i_dayObject



62
63
64
# File 'lib/jekyll/drops/url_drop.rb', line 62

def i_day
  @obj.date.strftime("%-d")
end

#i_monthObject



66
67
68
# File 'lib/jekyll/drops/url_drop.rb', line 66

def i_month
  @obj.date.strftime("%-m")
end

#minuteObject



54
55
56
# File 'lib/jekyll/drops/url_drop.rb', line 54

def minute
  @obj.date.strftime("%M")
end

#monthObject



42
43
44
# File 'lib/jekyll/drops/url_drop.rb', line 42

def month
  @obj.date.strftime("%m")
end

#nameObject



17
18
19
# File 'lib/jekyll/drops/url_drop.rb', line 17

def name
  Utils.slugify(@obj.basename_without_ext)
end

#secondObject



58
59
60
# File 'lib/jekyll/drops/url_drop.rb', line 58

def second
  @obj.date.strftime("%S")
end

#short_monthObject



70
71
72
# File 'lib/jekyll/drops/url_drop.rb', line 70

def short_month
  @obj.date.strftime("%b")
end

#short_yearObject



74
75
76
# File 'lib/jekyll/drops/url_drop.rb', line 74

def short_year
  @obj.date.strftime("%y")
end

#slugObject



26
27
28
# File 'lib/jekyll/drops/url_drop.rb', line 26

def slug
  Utils.slugify(@obj.data['slug']) || Utils.slugify(@obj.basename_without_ext)
end

#titleObject



21
22
23
24
# File 'lib/jekyll/drops/url_drop.rb', line 21

def title
  Utils.slugify(@obj.data['slug'], :mode => "pretty", :cased => true) ||
    Utils.slugify(@obj.basename_without_ext, :mode => "pretty", :cased => true)
end

#y_dayObject



78
79
80
# File 'lib/jekyll/drops/url_drop.rb', line 78

def y_day
  @obj.date.strftime("%j")
end

#yearObject



38
39
40
# File 'lib/jekyll/drops/url_drop.rb', line 38

def year
  @obj.date.strftime("%Y")
end