Need help writing birthday messages in Ruby
ruby
Solution
For a cake I would go with kopischke's answer, but for a card where there is more place I would choose to do this:
class Card
attr_accessor :event, :person
def initialize(event, person)
@event = event
@person = person
end
def message
"Happy #{event} to a #{person}!"
end
end
card = Card.new('birthday', 'special nerd')
puts card.message
Here's how that looks like in an editor for a nicer syntax highlighting:
Problem
So my boyfriend's 20th birthday is coming up soon and he's a programmer, so I thought I would make him a cake with ruby code that says "happy 20th birthday, Kyle" . I would also like to give him a card that says "happy birthday to a special nerd", again, in ruby code. Thanks for taking the time to read this. It means a lot to me.