Module: Lunetas::Candy::ClassMethods

Defined in:
lib/lunetas/candy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#_url_paramsObject (readonly)

Returns the value of attribute _url_params.



160
161
162
# File 'lib/lunetas/candy.rb', line 160

def _url_params
  @_url_params
end

#content_typeObject (readonly)

Returns the value of attribute content_type.



161
162
163
# File 'lib/lunetas/candy.rb', line 161

def content_type
  @content_type
end

Instance Method Details

#call(env) ⇒ Array

Support to be runned as a Rails Metal.

Parameters:

  • env (Hash)

    the Rack env.

Returns:

  • (Array)

    a standard Rack response.



166
167
168
169
170
171
172
173
174
# File 'lib/lunetas/candy.rb', line 166

def call(env)
  url_match = env['PATH_INFO'].match(@_regex)
  if url_match
    candy = new(env, url_match.to_a)
    candy.bite
  else
    [404, {"Content-Type" => "text/html", "X-Cascade" => "pass"}, ["Not Found"]]
  end
end