Class: Jekyll::IcalTag::Event
- Inherits:
-
Object
- Object
- Jekyll::IcalTag::Event
- Extended by:
- Forwardable
- Defined in:
- lib/jekyll-ical-tag/event.rb
Constant Summary collapse
- URL_REGEX =
/(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?/
Instance Method Summary collapse
- #attendees ⇒ Object
- #description_urls ⇒ Object
-
#initialize(event) ⇒ Event
constructor
A new instance of Event.
- #simple_html_description ⇒ Object
Constructor Details
#initialize(event) ⇒ Event
Returns a new instance of Event.
12 13 14 |
# File 'lib/jekyll-ical-tag/event.rb', line 12 def initialize(event) @event = event end |
Instance Method Details
#attendees ⇒ Object
28 29 30 |
# File 'lib/jekyll-ical-tag/event.rb', line 28 def attendees attendee.map(&:to_s).map { |a| a.slice!("mailto:"); a } end |
#description_urls ⇒ Object
32 33 34 |
# File 'lib/jekyll-ical-tag/event.rb', line 32 def description_urls @description_urls ||= description.to_s.force_encoding("UTF-8").scan(URL_REGEX).to_a end |
#simple_html_description ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/jekyll-ical-tag/event.rb', line 18 def simple_html_description @simple_html_description ||= begin description.clone.tap do |d| description_urls.each do |url| d.gsub! url, %(<a href='#{url}'>#{url}</a>) end end end end |