Module: Z4app
- Included in:
- APP
- Defined in:
- lib/z4app.rb,
lib/z4app/version.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.1.6"
- COMMIT =
`git log --format="%H" -n 1`.strip
- @@APP =
{ obj: Hash.new { |h,k| h[k] = lambda { |*a| puts %[[z4app][obj] #{a}]; { time: Time.now.to_s }; } }, get: Hash.new { |h,k| h[k] = lambda { |*a| puts %[[z4app][get] #{a}]; { time: Time.now.to_s }; } }, post: Hash.new { |h,k| h[k] = lambda { |*a| puts %[[z4app][post] #{a}]; { time: Time.now.to_s }; } } }
Class Method Summary collapse
-
.embed(s, h = {}) ⇒ Object
generate html content.
-
.init! ⇒ Object
start server.
-
.on(t, k, &b) ⇒ Object
overwrite event handlers.
Class Method Details
.embed(s, h = {}) ⇒ Object
generate html content.
108 109 110 |
# File 'lib/z4app.rb', line 108 def self. s, h={} Embed.new(s).result(h) end |
.init! ⇒ Object
start server
198 199 200 201 |
# File 'lib/z4app.rb', line 198 def self.init! Signal.trap('INT') { APP.die!; exit!; } Process.detach(fork { APP.run! { puts "[z4app][init] OK." } }) end |
.on(t, k, &b) ⇒ Object
overwrite event handlers
114 115 116 |
# File 'lib/z4app.rb', line 114 def self.on t, k, &b @@APP[t][k] = b end |