class Ars::Medium::TestMethods::RackChanneler

Attributes

path_map[RW]

Public Class Methods

new() click to toggle source
# File lib/ars/medium/test_methods.rb, line 25
def initialize
  @path_map = RHash.new
end

Public Instance Methods

body() click to toggle source
# File lib/ars/medium/test_methods.rb, line 53
def body
  []
end
call(env) click to toggle source
# File lib/ars/medium/test_methods.rb, line 41
def call(env)
  [status, headers, body]
end
focus(medium) click to toggle source
# File lib/ars/medium/test_methods.rb, line 29
def focus(medium)
  [:collection_path, :resource_path].each do |path|
    path = medium.send(path)
    path_regex = path_regex path
    path_map[path_regex] = { medium: medium, path: path, regex: path_regex }
  end
end
headers() click to toggle source
# File lib/ars/medium/test_methods.rb, line 49
def headers
  {}
end
path_regex(path) click to toggle source
# File lib/ars/medium/test_methods.rb, line 37
def path_regex(path)
  Regexp.new("^/#{path.gsub(/\:([^\/]+)/, '(?<\1>[^\/]+)')}$")
end
status() click to toggle source
# File lib/ars/medium/test_methods.rb, line 45
def status
  200
end