Sha256: 222cc258022b9ab663cb7e85204722cf15ae18a4552174aba12672307b58e0f7

Contents?: true

Size: 656 Bytes

Versions: 8

Compression:

Stored size: 656 Bytes

Contents

require_relative "contact_repository"

class ContactManagerPresenter
  attr_accessor :results
  @@contact_attributes = [:first_name, :last_name, :email]
  @@contact_attributes.each {|attribute_name| attr_accessor attribute_name}
  
  def initialize
    @contact_repository = ContactRepository.new
    @results = []
  end
  
  def list
    self.results=@contact_repository.find({})
  end
  
  def find
    filter_map = {}
    @@contact_attributes.each do |attribute_name| 
      filter_map[attribute_name] = self.send(attribute_name) if self.send(attribute_name)
    end
    self.results=@contact_repository.find(filter_map)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
glimmer-0.1.11.SWT4.14 samples/contactmanager/contact_manager_presenter.rb
glimmer-0.1.11.470 samples/contactmanager/contact_manager_presenter.rb
glimmer-0.1.10.470 samples/contactmanager/contact_manager_presenter.rb
glimmer-0.1.9.470 samples/contactmanager/contact_manager_presenter.rb
glimmer-0.1.8.470 samples/contactmanager/contact_manager_presenter.rb
glimmer-0.1.5.470 samples/contactmanager/contact_manager_presenter.rb
glimmer-0.1.4.470 samples/contactmanager/contact_manager_presenter.rb
glimmer-0.1.4.swt.pre.4.7.0 samples/contactmanager/contact_manager_presenter.rb