class CfScript::AppList

Public Class Methods

new(list = []) click to toggle source
# File lib/cf_script/object/app_list.rb, line 5
def initialize(list = [])
  @list = list
end

Public Instance Methods

==(other) click to toggle source
# File lib/cf_script/object/app_list.rb, line 15
def ==(other)
  names == other.names
end
each_name() { |name| ... } click to toggle source
# File lib/cf_script/object/app_list.rb, line 19
def each_name(&block)
  names.each { |name| yield(name) }
end
names() click to toggle source
# File lib/cf_script/object/app_list.rb, line 11
def names
  @list.map(&:name)
end
select!(options) click to toggle source
# File lib/cf_script/object/app_list.rb, line 23
def select!(options)
  if options[:matching]
    @list.select! { |app_info| app_info.name =~ /#{options[:matching]}/ }
  end

  if options[:starting_with]
    @list.reject! { |app_info| app_info.name !~ /\A#{options[:starting_with]}/ }
  end

  if options[:ending_with]
    @list.reject! { |app_info| app_info.name !~ /#{options[:ending_with]}\z/ }
  end

  if options[:state]
    @list.reject! { |app_info| app_info.requested_state !~ /\A#{options[:state]}\z/ }
  end
end