Class: WhatsOn::RubyConf
- Inherits:
-
Object
- Object
- WhatsOn::RubyConf
- Defined in:
- lib/whatson/rubyconf.rb
Instance Method Summary collapse
-
#initialize ⇒ RubyConf
constructor
A new instance of RubyConf.
- #print ⇒ Object
Constructor Details
#initialize ⇒ RubyConf
Returns a new instance of RubyConf.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/whatson/rubyconf.rb', line 7 def initialize ## turn down logger (default :debug?) LogUtils::Logger.root.level = :info r = EventDb::EventReader.from_url( "https://github.com/planetruby/awesome-events/raw/master/README.md" ) events = r.read @db = EventDb::Database.new @db.add( events ) end |
Instance Method Details
#print ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/whatson/rubyconf.rb', line 18 def print ## get next 17 events today = Date.today up = EventDb::Model::Event.limit( 17 ).upcoming( today ) ## pp up.to_sql ## pp up puts '' puts '' puts "Upcoming Ruby Conferences:" puts '' on = EventDb::Model::Event.live( today ) on.each do |e| current_day = today.mjd - e.start_date.mjd + 1 ## calculate current event day (1,2,3,etc.) puts " NOW ON #{current_day}d #{e.title} #{e.start_date.year}, #{e.date_str} (#{e.days}d) @ #{e.place}" end puts '' if on.any? up.each do |e| diff_days = e.start_date.mjd - today.mjd ## note: mjd == Modified Julian Day Number puts " in #{diff_days}d #{e.title}, #{e.date_str} (#{e.days}d) @ #{e.place}" end puts '' puts " More @ github.com/planetruby/awesome-events" puts '' end |