Sha256: 14877a644c9dd7634f812a581a0ddfabdfcc74d017b558c043e7dce427f153b0

Contents?: true

Size: 472 Bytes

Versions: 10

Compression:

Stored size: 472 Bytes

Contents

class ProjectCatalog

  def initialize
    @projects = []
  end

  def projects criteria = nil
    result = @projects.sort_by(&:name)

    return result if criteria.blank?
    result.find_all { |project|
      project.instance_eval criteria
    }
  end

  def add_project project
    @projects << project
    self
  end

  def save
    @projects.all? &:save
    self
  end

  def load
    @projects = Project.all
    self
  end

  def self.load
    self.new.load
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
techcor-0.0.10 lib/project_catalog.rb
techcor-0.0.9 lib/project_catalog.rb
techcor-0.0.8 lib/project_catalog.rb
techcor-0.0.7 lib/project_catalog.rb
techcor-0.0.6 lib/project_catalog.rb
techcor-0.0.5 lib/project_catalog.rb
techcor-0.0.4 lib/project_catalog.rb
techcor-0.0.3 lib/project_catalog.rb
techcor-0.0.2 lib/project_catalog.rb
techcor-0.0.1 lib/project_catalog.rb