Class: Bridgetown::Drops::UrlDrop
- Extended by:
- Forwardable
- Defined in:
- lib/bridgetown-core/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.
- #locale ⇒ Object (also: #lang)
-
#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
- #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, #each, #each_key, #fetch, #hash_for_json, #initialize, #inspect, #key?, #keys, #merge, #merge!, mutable, mutable?, #to_h, #to_json
Constructor Details
This class inherits a constructor from Bridgetown::Drops::Drop
Instance Method Details
#categories ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 35 def categories category_set = Set.new Array(@obj.data["categories"]).each do |category| category_set << if @obj.site.config["slugify_categories"] Utils.slugify(category.to_s) else category.to_s.downcase end end category_set.to_a.join("/") end |
#collection ⇒ Object
13 14 15 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 13 def collection @obj.collection.label end |
#day ⇒ Object
DD: 01..31
58 59 60 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 58 def day @obj.date.strftime("%d") end |
#hour ⇒ Object
hh: 00..23
63 64 65 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 63 def hour @obj.date.strftime("%H") end |
#i_day ⇒ Object
D: 1..31
78 79 80 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 78 def i_day @obj.date.strftime("%-d") end |
#i_month ⇒ Object
M: 1..12
83 84 85 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 83 def i_month @obj.date.strftime("%-m") end |
#locale ⇒ Object Also known as: lang
29 30 31 32 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 29 def locale locale_data = @obj.data["locale"] @obj.site.config["available_locales"].include?(locale_data) ? locale_data : nil end |
#long_day ⇒ Object
ddd: Monday..Sunday
125 126 127 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 125 def long_day @obj.date.strftime("%A") end |
#long_month ⇒ Object
MMMM: January..December
93 94 95 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 93 def long_month @obj.date.strftime("%B") end |
#minute ⇒ Object
mm: 00..59
68 69 70 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 68 def minute @obj.date.strftime("%M") end |
#month ⇒ Object
MM: 01..12
53 54 55 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 53 def month @obj.date.strftime("%m") end |
#name ⇒ Object
17 18 19 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 17 def name Utils.slugify(@obj.basename_without_ext) end |
#second ⇒ Object
ss: 00..59
73 74 75 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 73 def second @obj.date.strftime("%S") end |
#short_day ⇒ Object
dd: Mon..Sun
120 121 122 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 120 def short_day @obj.date.strftime("%a") end |
#short_month ⇒ Object
MMM: Jan..Dec
88 89 90 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 88 def short_month @obj.date.strftime("%b") end |
#short_year ⇒ Object
YY: 00..99
98 99 100 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 98 def short_year @obj.date.strftime("%y") end |
#slug ⇒ Object
25 26 27 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 25 def slug Utils.slugify(qualified_slug_data) end |
#title ⇒ Object
21 22 23 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 21 def title Utils.slugify(qualified_slug_data, mode: "pretty", cased: true) end |
#w_day ⇒ Object
d: 1..7 (Monday..Sunday)
115 116 117 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 115 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
104 105 106 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 104 def w_year @obj.date.strftime("%G") end |
#week ⇒ Object
WW: 01..53 %W and %U do not comply with ISO 8601-1
110 111 112 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 110 def week @obj.date.strftime("%V") end |
#y_day ⇒ Object
DDD: 001..366
130 131 132 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 130 def y_day @obj.date.strftime("%j") end |
#year ⇒ Object
CCYY
48 49 50 |
# File 'lib/bridgetown-core/drops/url_drop.rb', line 48 def year @obj.date.strftime("%Y") end |