Class: Camping::CommandsHelpers::RouteCollection

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#routesObject

Returns the value of attribute routes

Returns:

  • (Object)

    the current value of routes



33
34
35
# File 'lib/camping/commands.rb', line 33

def routes
  @routes
end

Instance Method Details

#displayObject

Displays formatted routes from a route collection Assumes that Route structs are stored in :routes.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/camping/commands.rb', line 37

def display
  current_app, current_controller, current_method = "", "", ""
  puts "App      VERB     Route"
  routes.each { |r|
    if current_app != r.app.to_s
      current_app = r.app.to_s
      puts "-----------------------------------"
      puts r.app_header
    end
    if current_controller != r.controller.to_s
      current_controller = r.controller.to_s
      puts r.controller_header
    end
    puts r.padded_message true
  }
end