class CF::Space::Spaces

Public Instance Methods

spaces() click to toggle source
# File lib/cf/cli/space/spaces.rb, line 16
def spaces
  spaces =
    with_progress("Getting spaces in #{c(org.name, :name)}") do
      org.spaces(:depth => quiet? ? 0 : 1).sort_by(&:name)
    end

  return if spaces.empty?

  line unless quiet?

  spaces.reject! do |s|
    !space_matches?(s, input)
  end

  if input[:full]
    spaced(spaces) do |s|
      invoke :space, :space => s, :full => input[:full]
    end
  else
    table(
      %w{name apps services},
      spaces.collect { |s|
        [c(s.name, :name),
          name_list(s.apps),
          name_list(s.service_instances)
        ]
      })
  end
end

Private Instance Methods

space_matches?(s, options) click to toggle source
# File lib/cf/cli/space/spaces.rb, line 48
def space_matches?(s, options)
  if name = options[:name]
    return false if s.name !~ /#{name}/
  end

  true
end