class Camping::CommandsHelpers::Route

Public Instance Methods

app_header() click to toggle source
# File lib/camping/commands.rb, line 37
def app_header
  "#{app.to_s}"
end
controller_header() click to toggle source
# File lib/camping/commands.rb, line 41
def controller_header
  "#{pad}#{app.to_s}::#{controller.to_s}"
end
padded_message(with_method = false) click to toggle source

pad the controller name to be the right length, if we can.

# File lib/camping/commands.rb, line 33
def padded_message(with_method = false)
  "#{pad}#{(with_method ? http_method.to_s.upcase.ljust(pad.length, " ") : pad)}#{replace_reg url}"
end
to_s() click to toggle source
# File lib/camping/commands.rb, line 28
def to_s
  "#{http_method}: #{url}"
end

Protected Instance Methods

http_methods() click to toggle source
# File lib/camping/commands.rb, line 47
def http_methods
  ["get", "post", "put", "patch", "delete"]
end
pad() click to toggle source
# File lib/camping/commands.rb, line 57
def pad
  "         "
end
replace_reg(pattern = "") click to toggle source
# File lib/camping/commands.rb, line 51
def replace_reg(pattern = "")
  xstr = "([^/]+)"; nstr = "(\d+)"
  pattern = pattern.gsub(xstr, ":string").gsub("(\\d+)", ":integer") unless pattern == "/"
  pattern
end