Module: Wee

Defined in:
lib/wee.rb,
lib/wee/state.rb,
lib/wee/request.rb,
lib/wee/session.rb,
lib/wee/callback.rb,
lib/wee/renderer.rb,
lib/wee/response.rb,
lib/wee/component.rb,
lib/wee/lru_cache.rb,
lib/wee/presenter.rb,
lib/wee/decoration.rb,
lib/wee/application.rb,
lib/wee/call_answer.rb,
lib/wee/html_canvas.rb,
lib/wee/html_writer.rb,
lib/wee/html_brushes.rb,
lib/wee/id_generator.rb,
lib/wee/html_document.rb,
lib/wee/jquery/jquery.rb

Defined Under Namespace

Modules: CallAnswerMixin, CallbackMixin, DecorationMixin, DupReplaceSnapshotMixin, ObjectSnapshotMixin, StructSnapshotMixin Classes: AnswerDecoration, Application, Brush, CallbackRegistry, Callbacks, Component, Decoration, Delegate, ErrorResponse, FormDecoration, GenericResponse, HtmlCanvas, HtmlDocument, HtmlWriter, IdGenerator, JQuery, LRUCache, PageDecoration, Presenter, RedirectResponse, RefreshResponse, Renderer, Request, Response, Session, State, WrapperDecoration

Constant Summary collapse

Version =
"2.1.0"
DefaultRenderer =
Wee::HtmlCanvas

Class Method Summary collapse

Class Method Details

.run(component_class = nil, mount_path = '/', port = 2000, &block) ⇒ Object

Raises:

  • (ArgumentError)


32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/wee.rb', line 32

def Wee.run(component_class=nil, mount_path='/', port=2000, &block)
  raise ArgumentError if component_class and block

  require 'rack/handler/webrick'
  app = Rack::Builder.app do
    map mount_path do
      if block
        run Wee::Application.new(&block)
      else
        run Wee::Application.new { Wee::Session.new(component_class.new) }
      end
    end
  end
  Rack::Handler::WEBrick.run(app, :Port => port)
end

.runcc(component_class, *args) ⇒ Object

Like Wee.run, but for use with continuations.



51
52
53
54
55
# File 'lib/wee.rb', line 51

def Wee.runcc(component_class, *args)
  Wee.run(nil, *args) {
    Wee::Session.new(component_class.new, Wee::Session::ThreadSerializer.new)
  }
end