Module: Hotwire::Response

Defined in:
lib/hotwire/response.rb,
lib/hotwire/response/csv.rb,
lib/hotwire/response/base.rb,
lib/hotwire/response/html.rb,
lib/hotwire/response/json.rb,
lib/hotwire/response/invalid.rb,
lib/hotwire/response/active_record_mixin.rb

Defined Under Namespace

Modules: ActiveRecordMixin Classes: Base, Csv, Html, Invalid, Json

Class Method Summary collapse

Class Method Details

.from_request(request) ⇒ Object

Factory method to create a Hotwire::Response instance from a Hotwire::Request object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/hotwire/response.rb', line 5

def self.from_request(request)
  case request[:out]
  when "json"
    Hotwire::Response::Json.new(request)
  when "html"
    Hotwire::Response::Html.new(request)
  when "csv"
    Hotwire::Response::Csv.new(request)
  else
    Hotwire::Response::Invalid.new(request)
  end
end