Created
August 12, 2013 20:35
-
-
Save klustig88/6214909 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Solution for Challenge: Design Drill: Public vs. Private Interfaces. Started 2013-08-12T16:17:53+00:00 | |
class BankAccount | |
attr_reader :customer_name, :type, :acct_number | |
attr_writer :customer_name | |
def initialize (customer_name, type, acct_number) | |
@customer_name = customer_name | |
@type = type | |
@acct_number = acct_number.gsub(/\d{3}-\d{3}/, '***-***') | |
end | |
def to_s | |
"My account informaion is: #{customer_name}, #{type}, #{acct_number}" | |
end | |
end | |
my_acct = BankAccount.new("John", "checking", "347-923-239") | |
p my_acct.customer_name | |
p my_acct.type | |
p my_acct.acct_number | |
p my_acct.to_s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment