-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Panda and Tiger #17
base: master
Are you sure you want to change the base?
Conversation
No, it means "made", as in manufactured. |
@@ -0,0 +1,220 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add these .idea
to your .gitignore file
(and if that sounds like klingon to you, let me know)
since Automobile will inherit from Vehicle, you should move the "model" variable up into Vehicle. There, both Vehicle and Automobile will have access to it. |
For example, check this out: http://rubyfiddle.com/riddles/70ebf ... The Vehicle has model variable, but automobile has access to it. class Vehicle
attr_reader :model
def initialize(args)
@model = args.fetch(:model)
end
end
class Automobile < Vehicle
attr_reader :year
def initialize(args)
super
@year = args.fetch(:year)
end
end
car = Automobile.new(year: 1991, model: "Yugo")
car.model |
Hi Jesse. I made some changes on the Episode 6 exercise but I'm stuck on a Firstly and most importantly I can't work out how to send you a pull git commit -am "Feature: Redid Panda-Tiger" and the file changes show up in my repository, but I can't figure out how Secondly, In my code, I just pulled all the variables from the Automobile super(args) inside the initialize and update methods in automobile. The problem is that Episode6/models/Vehicle.rb:5:in `fetch': key not found: :tires (KeyError) How can I easily pass only some of the variables into a child class method Best wishes, Danny Bradbury On 13 January 2014 06:45, Jesse Wolgamott [email protected] wrote:
|
On Friday, January 17, 2014 at 10:55 PM, ThePomodoro wrote:
“@jwo I’ve updated the code for x,y,z"
@Tires = args[:tires] if args[:tires] An alternative syntax, where we set it to itself if the key doesn’t exist @Tires = args.fetch(:tires, @Tires)
|
Hi Jesse. I completed the Panda and Tiger assignments, but was stumped by the Eagle one as I couldn't see a discussion of class objects or inheritance in video 6 or any of the previous videos I saw.
You asked:
"1. Create a class variable (@@) in the Vehicle that tracks all vehicles mde"
Does mde mean model?
I had created a class 'Vehicle' that the other classes inherited from, but vehicle didn't have a model variable, and I wasn't sure whether to recreate one, given that there was already one in automobile. What's the best approach?
Will begin watching first 3 episodes of TDD course next.