Module: Usher::Interface

Defined in:
lib/usher/interface.rb,
lib/usher/interface/rack.rb,
lib/usher/interface/text.rb,
lib/usher/interface/rails3.rb,
lib/usher/interface/rails20.rb,
lib/usher/interface/rails22.rb,
lib/usher/interface/rails23.rb,
lib/usher/interface/sinatra.rb,
lib/usher/interface/rack/route.rb,
lib/usher/interface/rack/builder.rb,
lib/usher/interface/rails22/mapper.rb,
lib/usher/interface/rails23/mapper.rb,
lib/usher/interface/rack/middleware.rb

Overview

Various interfaces for Usher.

Defined Under Namespace

Classes: Rack, Rails20, Rails22, Rails23, Rails3, Sinatra, Text

Class Method Summary collapse

Class Method Details

.class_for(name) ⇒ Object

Returns the appropriate interface class for a given name.

Parameters:

  • name (Symbol, String)

    The interface you wish to load. This can be ‘:rails20`, `:rails22`, `:rails23`, `:rack`, `:rails3` or `:sinatra`



14
15
16
17
# File 'lib/usher/interface.rb', line 14

def self.class_for(name)
  Usher::Interface.const_get(name.to_s.split(/_/).map{|e| e.capitalize}.join) or
    raise ArgumentError, "Interface #{name.inspect} doesn't exist."
end

.for(name, *args, &block) ⇒ Object

Returns the appropriate interface class for a given name.

Parameters:

  • name (Symbol, String)

    The interface you wish to load. This can be ‘:rails20`, `:rails22`, `:rails23`, `:rack`, `:rails3` or `:sinatra`

  • args (Object)

    Any additional parameters the interface wishes to recieve

Returns:

  • (Object)

    An intatiated interface



23
24
25
# File 'lib/usher/interface.rb', line 23

def self.for(name, *args, &block)
  class_for(name).new(*args, &block)
end