Skip to content

Instantly share code, notes, and snippets.

@mtmcfarl
Created May 23, 2013 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtmcfarl/5639124 to your computer and use it in GitHub Desktop.
Save mtmcfarl/5639124 to your computer and use it in GitHub Desktop.
Contact Presenter
class VendorContactPresenter < BasePresenter
def initialize(contact)
@contact = contact
end
def full_name
"#{@contact.first_name} #{@contact.last_name}"
end
def email
@contact.email
end
def phone_numbers
office_number unless @contact.office_number.blank?
mobile_number unless @contact.mobile_number.blank?
fax_number unless @contact.fax_number.blank?
end
def mobile_number
"#{@contact.mobile_number} (Mobile)"
end
def fax_number
"#{@contact.fax_number} (Fax)"
end
def office_number
"#{@contact.office_number} (Office)"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment