Class: Camping::CommandsHelpers::Route

Inherits:
Struct
  • Object
show all
Defined in:
lib/camping/commands.rb,
lib/camping/commands.rb

Overview

Route Struct, for making and formatting a route.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#appObject

Returns the value of attribute app

Returns:

  • (Object)

    the current value of app



57
58
59
# File 'lib/camping/commands.rb', line 57

def app
  @app
end

#controllerObject

Returns the value of attribute controller

Returns:

  • (Object)

    the current value of controller



57
58
59
# File 'lib/camping/commands.rb', line 57

def controller
  @controller
end

#http_methodObject

Returns the value of attribute http_method

Returns:

  • (Object)

    the current value of http_method



57
58
59
# File 'lib/camping/commands.rb', line 57

def http_method
  @http_method
end

#urlObject

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



57
58
59
# File 'lib/camping/commands.rb', line 57

def url
  @url
end

Instance Method Details

#app_headerObject



69
70
71
# File 'lib/camping/commands.rb', line 69

def app_header
  "#{app.to_s}"
end

#controller_headerObject



73
74
75
# File 'lib/camping/commands.rb', line 73

def controller_header
  "#{pad}#{app.to_s}::#{controller.to_s}"
end

#padded_message(with_method = false) ⇒ Object

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



65
66
67
# File 'lib/camping/commands.rb', line 65

def padded_message(with_method = false)
  "#{pad}#{(with_method ? http_method.to_s.upcase.ljust(pad.length, " ") : pad)}#{replace_reg url}"
end

#to_sObject



60
61
62
# File 'lib/camping/commands.rb', line 60

def to_s
  "#{controller}: #{http_method}: #{url} - #{replace_reg url}"
end