Skip to content

Conversation

dnourie
Copy link

@dnourie dnourie commented May 4, 2014

I added an extra line at the end that wasn't necessary for printing, but I thought it was neat when I tried it out. I had not heard of Struct before!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GREAT job with putting info as a method on train. 👍

@jwo
Copy link
Member

jwo commented May 5, 2014

most excellent submission!

The only change I'd make. Below, you coming "data" with "presentation". That is, the trip method executes "puts", so it doesn't return data. Instead, it outputs to the screen.

Passenger = Struct.new(:name, :train) do
   def trip
    puts "#{name} is riding the #{train} while on vacation."
   end
  end

Instead, I would have the trip return information about the trip. In this case, trip should return a formatting string. something like:

Passenger = Struct.new(:name, :train) do
   def trip
    "#{name} is riding the #{train} while on vacation."
   end
  end

first_passenger = Passenger.new("Sharon", "amtrack")
puts first_passenger.trip

@dnourie
Copy link
Author

dnourie commented May 7, 2014

Thank you. That makes sense and is helpful. I made the correction.

Dana

On Mon, May 5, 2014 at 12:03 PM, Jesse Wolgamott
[email protected]:

most excellent submission!

The only change I'd make. Below, you coming "data" with "presentation".
That is, the trip method executes "puts", so it doesn't return data.
Instead, it outputs to the screen.

Passenger = Struct.new(:name, :train) do
def trip
puts "#{name} is riding the #{train} while on vacation."
end
end

Instead, I would have the trip return information about the trip. In this
case, trip should return a formatting string. something like:

Passenger = Struct.new(:name, :train) do
def trip
"#{name} is riding the #{train} while on vacation."
end
end

first_passenger = Passenger.new("Sharon", "amtrack")
puts first_passenger.trip


Reply to this email directly or view it on GitHubhttps://github.com//pull/21#issuecomment-42224934
.

Dana Nourie
http://www.dananourie.com

@jwo
Copy link
Member

jwo commented May 7, 2014

Coooool! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants