Class: JekyllIndico::Meetings
- Inherits:
-
Object
- Object
- JekyllIndico::Meetings
- Defined in:
- lib/jekyll-indico/core.rb
Overview
Look for topical meetings
Instance Attribute Summary collapse
-
#dict ⇒ Object
Returns the value of attribute dict.
Instance Method Summary collapse
-
#initialize(base_url, indico_id, limit: nil, **kargs) ⇒ Meetings
constructor
ID for IRIS-HEP: 10570.
-
#to_files(folder) ⇒ Object
Write out files (Folder given, by key name).
Constructor Details
#initialize(base_url, indico_id, limit: nil, **kargs) ⇒ Meetings
ID for IRIS-HEP: 10570
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/jekyll-indico/core.rb', line 26 def initialize(base_url, indico_id, limit: nil, **kargs) @dict = {} download_and_iterate(base_url, indico_id, limit: limit, **kargs) do |i| # Trim paragraph tags d = i['description'] d = d[3..] if d.start_with? '<p>' d = d[0..-5] if d.end_with? '</p>' start_date = Date.parse i['startDate']['date'] fname = start_date.strftime('%Y%m%d').to_s youtube = '' urllist = URI.extract(d) urllist.each do |url| youtube = url if url.include?('youtube') || url.include?('youtu.be') end @dict[fname] = { 'name' => i['title'], 'startdate' => start_date, 'meetingurl' => i['url'], 'location' => i['location'], 'youtube' => youtube, 'description' => d } end end |
Instance Attribute Details
#dict ⇒ Object
Returns the value of attribute dict.
23 24 25 |
# File 'lib/jekyll-indico/core.rb', line 23 def dict @dict end |
Instance Method Details
#to_files(folder) ⇒ Object
Write out files (Folder given, by key name)
56 57 58 59 60 61 |
# File 'lib/jekyll-indico/core.rb', line 56 def to_files(folder) @dict.each do |key, dict| yield key if block_given? File.write(folder / "#{key}.yml", dict.to_yaml) end end |