Skip to content

Instantly share code, notes, and snippets.

@jgburet
Last active February 22, 2016 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgburet/cc4901799acd0c605f37 to your computer and use it in GitHub Desktop.
Save jgburet/cc4901799acd0c605f37 to your computer and use it in GitHub Desktop.
fakeModule1 do
description {
"This is a nice description of this fake module"
}
author { "Jean-Guillaume Buret" }
usage { 'Just run it!' }
init { SubClassInFakeModule1.new() }
loop_block { |selector, instance_of_sub_class_in_fake_module|
instance_of_sub_class_in_fake_module.refresh_ui
}
impl {
class SubClassInFakeModule1
def initialize(n = 'world')
@name = n
end
def hello
puts 'hello ' + @name
end
end
class SubClassInFakeModule2
end
}
end
fakeModule1 do
description {
"This is a nice description of this fake module"
}
author { "Jean-Guillaume Buret" }
usage { 'Just run it!' }
init { MyWonderfulUI.new() }
impl {
class MyWonderfulUI
def initialize()
@messages_received = []
end
def _loop(selector)
end
def _callback_read(source_stream, message)
@messages_received << message
end
def _callback_write(source_stream)
end
end
}
end
fakeModule1 do
description
"This is a nice description of this fake module"
author
"Jean-Guillaume Buret"
usage
'Just run it!'
instance {
MyWonderfulUI.new()
}
# why not just provide the constant on which we can call .new()
impl {
class MyWonderfulUI
def initialize()
@messages_received = []
end
def _loop(selector)
end
def _callback_read(source_stream, message)
@messages_received << message
end
def _callback_write(source_stream)
end
end
class SomeClassUsedByTheMainOne
# some code in here
end
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment