Sha256: 35a90fc901fe689799639c5460dacf403182f1a734fa1851cebc765edef829e3
Contents?: true
Size: 636 Bytes
Versions: 5
Compression:
Stored size: 636 Bytes
Contents
require 'thread' require 'lotus/router' module Lotus class Container attr_reader :routes def self.configure(&blk) Mutex.new.synchronize { @@configuration = blk } end def initialize Mutex.new.synchronize do assert_configuration_presence! @routes = Lotus::Router.new(&@@configuration) end end def call(env) @routes.call(env) end private def assert_configuration_presence! unless self.class.class_variable_defined?(:@@configuration) raise ArgumentError.new("#{ self.class } doesn't have any application mounted.") end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
lotusrb-0.3.2 | lib/lotus/container.rb |
lotusrb-0.3.1 | lib/lotus/container.rb |
lotusrb-0.3.0 | lib/lotus/container.rb |
lotusrb-0.2.1 | lib/lotus/container.rb |
lotusrb-0.2.0 | lib/lotus/container.rb |