Created
May 23, 2013 20:22
-
-
Save mtmcfarl/5639124 to your computer and use it in GitHub Desktop.
Contact Presenter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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