Class: Jekyll::Drops::UrlDrop
- Extended by:
- Forwardable
- Defined in:
- lib/jekyll/drops/url_drop.rb
Constant Summary
Constants inherited from Drop
Instance Method Summary collapse
- #categories ⇒ Object
- #collection ⇒ Object
-
#day ⇒ Object
DD: 01..31.
-
#hour ⇒ Object
hh: 00..23.
-
#i_day ⇒ Object
D: 1..31.
-
#i_month ⇒ Object
M: 1..12.
-
#long_day ⇒ Object
ddd: Monday..Sunday.
-
#long_month ⇒ Object
MMMM: January..December.
-
#minute ⇒ Object
mm: 00..59.
-
#month ⇒ Object
MM: 01..12.
- #name ⇒ Object
-
#second ⇒ Object
ss: 00..59.
-
#short_day ⇒ Object
dd: Mon..Sun.
-
#short_month ⇒ Object
MMM: Jan..Dec.
-
#short_year ⇒ Object
YY: 00..99.
- #slug ⇒ Object
-
#slugified_categories ⇒ Object
Similar to output from #categories, but each category will be downcased and all non-alphanumeric characters of the category replaced with a hyphen.
- #title ⇒ Object
-
#w_day ⇒ Object
d: 1..7 (Monday..Sunday).
-
#w_year ⇒ Object
CCYYw, ISO week year may differ from CCYY for the first days of January and last days of December.
-
#week ⇒ Object
WW: 01..53 %W and %U do not comply with ISO 8601-1.
-
#y_day ⇒ Object
DDD: 001..366.
-
#year ⇒ Object
CCYY.
Methods inherited from Drop
#[], #[]=, #content_methods, data_delegator, data_delegators, delegate_method, delegate_method_as, delegate_methods, #each, #each_key, #fetch, getter_method_names, #hash_for_json, #initialize, #inspect, #key?, #keys, #merge, #merge!, mutable, mutable?, private_delegate_methods, #to_h, #to_json
Constructor Details
This class inherits a constructor from Jekyll::Drops::Drop
Instance Method Details
#categories ⇒ Object
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 |
#collection ⇒ Object
13 14 15 |
# File 'lib/jekyll/drops/url_drop.rb', line 13 def collection @obj.collection.label end |
#day ⇒ Object
DD: 01..31
57 58 59 |
# File 'lib/jekyll/drops/url_drop.rb', line 57 def day @obj.date.strftime("%d") end |
#hour ⇒ Object
hh: 00..23
62 63 64 |
# File 'lib/jekyll/drops/url_drop.rb', line 62 def hour @obj.date.strftime("%H") end |
#i_day ⇒ Object
D: 1..31
77 78 79 |
# File 'lib/jekyll/drops/url_drop.rb', line 77 def i_day @obj.date.strftime("%-d") end |
#i_month ⇒ Object
M: 1..12
82 83 84 |
# File 'lib/jekyll/drops/url_drop.rb', line 82 def i_month @obj.date.strftime("%-m") end |
#long_day ⇒ Object
ddd: Monday..Sunday
124 125 126 |
# File 'lib/jekyll/drops/url_drop.rb', line 124 def long_day @obj.date.strftime("%A") end |
#long_month ⇒ Object
MMMM: January..December
92 93 94 |
# File 'lib/jekyll/drops/url_drop.rb', line 92 def long_month @obj.date.strftime("%B") end |
#minute ⇒ Object
mm: 00..59
67 68 69 |
# File 'lib/jekyll/drops/url_drop.rb', line 67 def minute @obj.date.strftime("%M") end |
#month ⇒ Object
MM: 01..12
52 53 54 |
# File 'lib/jekyll/drops/url_drop.rb', line 52 def month @obj.date.strftime("%m") end |
#name ⇒ Object
17 18 19 |
# File 'lib/jekyll/drops/url_drop.rb', line 17 def name Utils.slugify(@obj.basename_without_ext) end |
#second ⇒ Object
ss: 00..59
72 73 74 |
# File 'lib/jekyll/drops/url_drop.rb', line 72 def second @obj.date.strftime("%S") end |
#short_day ⇒ Object
dd: Mon..Sun
119 120 121 |
# File 'lib/jekyll/drops/url_drop.rb', line 119 def short_day @obj.date.strftime("%a") end |
#short_month ⇒ Object
MMM: Jan..Dec
87 88 89 |
# File 'lib/jekyll/drops/url_drop.rb', line 87 def short_month @obj.date.strftime("%b") end |
#short_year ⇒ Object
YY: 00..99
97 98 99 |
# File 'lib/jekyll/drops/url_drop.rb', line 97 def short_year @obj.date.strftime("%y") end |
#slug ⇒ Object
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 |
#slugified_categories ⇒ Object
Similar to output from #categories, but each category will be downcased and all non-alphanumeric characters of the category replaced with a hyphen.
40 41 42 43 44 |
# File 'lib/jekyll/drops/url_drop.rb', line 40 def slugified_categories Array(@obj.data["categories"]).each_with_object(Set.new) do |category, set| set << Utils.slugify(category.to_s) end.to_a.join("/") end |
#title ⇒ Object
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 |
#w_day ⇒ Object
d: 1..7 (Monday..Sunday)
114 115 116 |
# File 'lib/jekyll/drops/url_drop.rb', line 114 def w_day @obj.date.strftime("%u") end |
#w_year ⇒ Object
CCYYw, ISO week year may differ from CCYY for the first days of January and last days of December
103 104 105 |
# File 'lib/jekyll/drops/url_drop.rb', line 103 def w_year @obj.date.strftime("%G") end |
#week ⇒ Object
WW: 01..53 %W and %U do not comply with ISO 8601-1
109 110 111 |
# File 'lib/jekyll/drops/url_drop.rb', line 109 def week @obj.date.strftime("%V") end |
#y_day ⇒ Object
DDD: 001..366
129 130 131 |
# File 'lib/jekyll/drops/url_drop.rb', line 129 def y_day @obj.date.strftime("%j") end |
#year ⇒ Object
CCYY
47 48 49 |
# File 'lib/jekyll/drops/url_drop.rb', line 47 def year @obj.date.strftime("%Y") end |