Parent

Class/Module Index [+]

Quicksearch

Admin::Suggestion::Container

Constants

VALID_SCOPES

Public Instance Methods

+(add) click to toggle source
# File lib/admin/suggestion/types.rb, line 222
def +(add)  # need to return a Container - default morphs to Array
  if add.is_a? Array
    add.each {|x| self << x}
  else # adding an element, don't make me think about += vs <<
    self << add
  end
  self
end
compact() click to toggle source
# File lib/admin/suggestion/types.rb, line 230
def compact  # need to return a Container - default morphs to Array
  Container.new + super
end
for_district(uuid) click to toggle source
# File lib/admin/suggestion/types.rb, line 251
def for_district(uuid)
  Container.new + select {|sugg| sugg.district_uuid == uuid}
end
for_general() click to toggle source
# File lib/admin/suggestion/types.rb, line 245
def for_general
  for_scope("general")
end
for_profile(profile) click to toggle source
# File lib/admin/suggestion/types.rb, line 248
def for_profile(profile)
  Container.new + select {|sugg| sugg.profile == profile}
end
for_scope(scope, filter = nil) click to toggle source
# File lib/admin/suggestion/types.rb, line 235
def for_scope(scope, filter = nil)
  VALID_SCOPES.include?(scope) || raise("invalid scope: #{scope}")
  c = Container.new + select {|sugg| sugg.scope == scope}
  return c if filter.nil?
  case scope
    when "profile";  c.for_profile(filter)
    when "district"; c.for_district(filter)
    else;            c
  end
end
group_by_class() click to toggle source
# File lib/admin/suggestion/types.rb, line 260
def group_by_class
  inject(Hash.new) {|h,sugg| (h[sugg.class] ||= Container.new) << sugg; h }
end
group_by_district_uuid() click to toggle source
# File lib/admin/suggestion/types.rb, line 257
def group_by_district_uuid
  inject(Hash.new) {|h,sugg| (h[sugg.district_uuid] ||= Container.new) << sugg; h }
end
group_by_profile() click to toggle source
# File lib/admin/suggestion/types.rb, line 254
def group_by_profile
  inject(Hash.new) {|h,sugg| (h[sugg.profile] ||= Container.new) << sugg; h }
end
important(filter = true) click to toggle source
# File lib/admin/suggestion/types.rb, line 263
def important(filter = true)
  Container.new + select {|sugg| sugg.important? == filter}
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.