Dreaming in Ruby

23 Mar

class Dreaming

   def initialize(d)
   @dream = d
   @time = "soon"
   end

   def display
   puts "So, your dream is #{@dream} and you want it to happen #{@time}."
   end

   def grant
        if @dream.include? 'writer'
        puts "Don't worry, it will happen."
        else
        puts "Keep on dreaming, hoping and working."
        end
   end

end

my_dream = Dreaming.new "to be a writer"

my_dream.display

my_dream.grant

Outputs:

“So, your dream is to be a writer and you want it to happen soon.”

“Don’t worry, it will happen.”

(Sigh) If only it were that simple…

Advertisements

3 Responses to “Dreaming in Ruby”

  1. Tita April 12, 2011 at 9:05 pm #

    it pretty simple, you just have to keep writing 🙂

  2. monica bistrain June 23, 2011 at 5:55 pm #

    i think u are one already Leah – but have not realized it!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: