Created
September 17, 2015 00:21
-
-
Save buren/4f7be9d8dc7a0913e2cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DEADLINE = Time.new(2015, 9, 21, 13, 0, 0).freeze | |
module Audience;end | |
module Audience::Talk;end | |
String.class_eval { define_method(:last?) { false } } | |
NilClass.class_eval { define_method(:last?) { true } } | |
define_method(:wait) { puts 'Still not ready..';sleep 3 } | |
define_method(:any_questions?) { puts 'Any questions?' } | |
define_method(:feedback) { puts 'Feedback?' } | |
class Audience::Presenter < Struct.new(:name) | |
define_method(:ready?) { Time.now >= DEADLINE } | |
def present(slides); slides.to_a.each { |slide| yield(slide) };end | |
end | |
class Audience::Talk::Slides | |
define_method(:initialize) { @slides = File.read('slides.md').split('---') } | |
define_method(:to_a) { @slides + [nil] } | |
end | |
# | |
# ####### | |
# ####### | |
# ####### | |
# | |
include Audience | |
author = Presenter.new(:jacob) | |
slides = Talk::Slides.new | |
wait until author.ready? | |
author.present(slides) do |slide| | |
print slide | |
any_questions? if slide.last? | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment