Class: Jekyll::IcalTag::Event
- Inherits:
-
Object
- Object
- Jekyll::IcalTag::Event
- Defined in:
- lib/jekyll-ical-tag/event.rb
Constant Summary collapse
- URL_REGEX =
/ (?:(?:https?|ftp):\/\/) # Allowable schemes (?:\S+(?::\S*)?@)? # username:password, which is optional (?: # Domain part follows; non-capturing # These IP addresses are valid domain values (?!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})? # Optional port number (?:\/[^\s"]*)? # Anything that is not a space or a double quote /x
Instance Attribute Summary collapse
-
#all_properties ⇒ Object
readonly
Returns the value of attribute all_properties.
Instance Method Summary collapse
- #attendees ⇒ Object
- #description_urls ⇒ Object
-
#initialize(ical_event) ⇒ Event
constructor
A new instance of Event.
- #simple_html_description ⇒ Object
Constructor Details
#initialize(ical_event) ⇒ Event
Returns a new instance of Event.
32 33 34 35 36 |
# File 'lib/jekyll-ical-tag/event.rb', line 32 def initialize(ical_event) @ical_event = ical_event setup_all_properties! setup_property_accessor_methods! end |
Instance Attribute Details
#all_properties ⇒ Object (readonly)
Returns the value of attribute all_properties.
38 39 40 |
# File 'lib/jekyll-ical-tag/event.rb', line 38 def all_properties @all_properties end |
Instance Method Details
#attendees ⇒ Object
50 51 52 |
# File 'lib/jekyll-ical-tag/event.rb', line 50 def attendees ical_event.attendee.map(&:to_s).map { |a| a.slice!("mailto:"); a } end |
#description_urls ⇒ Object
54 55 56 57 58 |
# File 'lib/jekyll-ical-tag/event.rb', line 54 def description_urls return [] unless description @description_urls ||= description.scan(URL_REGEX).to_a end |
#simple_html_description ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/jekyll-ical-tag/event.rb', line 40 def simple_html_description @simple_html_description ||= begin description.clone.tap do |description| description_urls.each do |url| description.gsub! url, %(<a href='#{url}'>#{url}</a>) end end end end |