class CfScript::Command::Routes::RoutesCommand

Constants

ROUTES_TABLE

Public Class Methods

new() click to toggle source
Calls superclass method CfScript::Command::Base::new
# File lib/cf_script/command/cf/routes/routes.rb, line 5
def initialize
  super(:routes, :routes)
end

Public Instance Methods

run(*args) { |routes| ... } click to toggle source
# File lib/cf_script/command/cf/routes/routes.rb, line 9
def run(*args, &block)
  run_cf self do |output|
    return unless good_run?(output)

    if rows = output.table(ROUTES_TABLE)
      routes = build_route_info(rows)

      block_given? ? yield(routes) : routes
    else
      error "Routes table was not found"
    end
  end
end

Private Instance Methods

build_route_info(rows) click to toggle source
# File lib/cf_script/command/cf/routes/routes.rb, line 25
def build_route_info(rows)
  routes = []

  rows.each do |row|
    routes << CfScript::RouteInfo.new(
      row[:space].value,
      row[:host].value,
      row[:domain].value,
      row[:apps].to_a
    )
  end

  routes
end