aboutsummaryrefslogtreecommitdiffstats
path: root/lib/events.rb
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2023-10-10 21:10:19 +0200
committerHarald Eilertsen <haraldei@anduin.net>2023-10-10 21:10:19 +0200
commit51ef51bbe3b741a76d1d44b8ce8c1d8a07427e1f (patch)
tree4f2b4b8a0df7669f6de73496be578f6340ade3c3 /lib/events.rb
parent68e89035e51a3fa6d0a54ee7d5f27259090b101e (diff)
downloadramaskrik-program-master.tar.gz
ramaskrik-program-master.tar.bz2
ramaskrik-program-master.zip
Updates for Ramaskrik 2023HEADmaster
- Reorg, create lib dir and move room-schedule and events there - Add .ics template to generate program as an iCalendar stream. - Add some info to html template, and instructions to html template. - Add footer to html template, with timestamp for when the view was generated. - Fix bug that messed up the layout if the input data was not already sorted. - Update readme with usage instructions.
Diffstat (limited to 'lib/events.rb')
-rw-r--r--lib/events.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/events.rb b/lib/events.rb
new file mode 100644
index 0000000..e647930
--- /dev/null
+++ b/lib/events.rb
@@ -0,0 +1,28 @@
+require 'time'
+
+module Events
+ class Event
+
+ attr_reader :start_time
+ attr_reader :duration
+ attr_reader :title
+ attr_reader :venue
+ attr_reader :image_url
+
+ def initialize(attrs)
+ @start_time = Time.parse(attrs['start_time'])
+ @duration = attrs['duration'].to_i
+ @title = attrs['title']
+ @venue = attrs['venue']
+ @image_url = attrs['image'] unless attrs['image'].length < 10
+ end
+
+ def date
+ @start_time.to_date
+ end
+
+ def slug
+ "#{start_time.to_i}-#{title.downcase.gsub(/[^a-z0-9_-]/, '')}"
+ end
+ end
+end