learn-co-curriculum / phase-3-ruby-oo-inheritance-modules Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
https://learning.flatironschool.com/courses/5187/assignments/180355?module_item_id=397998
should "instances" be "instance" in the following?
intended to be used as instances methods
No response
maybe change this:
intended to be used as instances methods
to this?:
intended to be used as instance methods
https://learning.flatironschool.com/courses/5187/assignments/180355?module_item_id=397998
It's not clear to me how/where I should do this:
We can call:
Should I put these commands inside a bin file? 'extending'? 'dance_party'?
Do I run them from 'pry'? irb?
By the way, was I supposed to gut class Dancer with this or should I have left the initialize part there?
class Dancer
extend FancyDance::ClassMethods
include FancyDance::InstanceMethods
end
(I left the initialize stuff in place.)
No response
I should probably know how/where to invoke the "We can call" stuff, but, well,...
https://learning.flatironschool.com/courses/5286/assignments/172694?module_item_id=376688
This needs to be changed:
Guess what? There is! We're going to refactor the two modules into one, and use module namespacing to clarify how our code should be used.
module FancyDance
module InstanceMethods
def twirl
"I'm twirling!"
end
def jump
"Look how high I'm jumping!"
end
def pirouette
"I'm doing a pirouette"
end
def take_a_bow
"Thank you, thank you. It was a pleasure to dance for you all."
end
end
module ClassMethods
def metadata
"This class produces objects that love to dance."
end
end
end
No response
Guess what? There is! We're going to refactor the two modules into one, and use module namespacing to clarify how our code should be used.
In '/lib/fancy_dance.rb':
module FancyDance
module InstanceMethods
def twirl
"I'm twirling!"
end
def jump
"Look how high I'm jumping!"
end
def pirouette
"I'm doing a pirouette"
end
def take_a_bow
"Thank you, thank you. It was a pleasure to dance for you all."
end
end
module ClassMethods
def metadata
"This class produces objects that love to dance."
end
end
end
Thanks for raising this issue! Future learners thank you for your diligence. In
order to help the curriculum team address the problem, please use this template
to submit your feedback. We'll work on addressing the issue as soon as we can.
Please fill out as much of the information below as you can (it's ok if you
don't fill out every section). The more context we have, the easier it will be
to fix your issue!
Note: you should only raise issues related to the contents of this lesson.
If you have questions about your code or need help troubleshooting, reach out to
an instructor/your peers.
https://learning.flatironschool.com/courses/4214/assignments/135694?module_item_id=281489
Add a link to the assignment in Canvas here.
Sentence with typos:
"The same module namespacing syntax we used can also above can also be used to namespace classes."
Sentence fixed:
"The same module namespacing syntax we used above can also be used to namespace classes."
Suggest your change here. Let us know what section or line of the Readme needs
to be updated, and any proposed corrections. Include the line number(s) if
possible.
Add any other context about the problem here.
https://learning.flatironschool.com/courses/5286/assignments/172694?module_item_id=376688
This section needs to have a reference to the actual 'namespace resolution operator':
We refer to the namespaced modules or classes with ::
No response
Changed Section:
We refer to the namespaced modules or classes with '::', the 'namespace resolution operator'.
Reference:
Thanks for raising this issue! Future learners thank you for your diligence. In
order to help the curriculum team address the problem, please use this template
to submit your feedback. We'll work on addressing the issue as soon as we can.
Please fill out as much of the information below as you can (it's ok if you
don't fill out every section). The more context we have, the easier it will be
to fix your issue!
Note: you should only raise issues related to the contents of this lesson.
If you have questions about your code or need help troubleshooting, reach out to
an instructor/your peers.
Add a link to the assignment in Canvas here.
https://learning.flatironschool.com/courses/4214/assignments/135694?confetti=true&submitted=0
The Readme indicates that you should run learn test and save work right before proceeding to step 3 as code will be rearranged later and tests won't pass anymore. However, I found that several tests continued to fail at that point and did not pass until I required fancy_dance.rb in kid.rb and dancer.rb filled fancy_dance.rb with its code (but not changing the includes/extend syntax for it). For some reason the tests seem to require fancy_dance.rb). the tests that failed were Dancer/Kid includes the Dance module and Dancer/Kid extends the MetaDancing module but the NameError in all of them was "uninitialized constant FancyDance".
Add any other context about the problem here.
Here is the copied over error block when you stop where indicated:
Dance
has a #twirl method
has a #jump method
has a #pirouette method
has a #take_a_bow method
Dancer
includes the Dance module (FAILED - 1)
has a name
extends the MetaDancing module (FAILED - 2)
Kid
includes the Dance module (FAILED - 3)
has a name
extends the MetaDancing module (FAILED - 4)
MetaDancing
has a metadata method
Failures:
Dancer includes the Dance module
Failure/Error: (actual.is_a? FancyDance::InstanceMethods) || (actual.is_a? Dance)
NameError:
uninitialized constant FancyDance
Dancer extends the MetaDancing module
Failure/Error: (actual.is_a? FancyDance::ClassMethods) || (actual.is_a? MetaDancing)
NameError:
uninitialized constant FancyDance
Kid includes the Dance module
Failure/Error: (actual.is_a? FancyDance::InstanceMethods) || (actual.is_a? Dance)
NameError:
uninitialized constant FancyDance
Kid extends the MetaDancing module
Failure/Error: (actual.is_a? FancyDance::ClassMethods) || (actual.is_a? MetaDancing)
NameError:
uninitialized constant FancyDance
Finished in 0.00643 seconds (files took 0.22661 seconds to load)
11 examples, 4 failures
Failed examples:
rspec ./spec/dancer_spec.rb:4 # Dancer includes the Dance module
rspec ./spec/dancer_spec.rb:13 # Dancer extends the MetaDancing module
rspec ./spec/kid_spec.rb:4 # Kid includes the Dance module
rspec ./spec/kid_spec.rb:13 # Kid extends the MetaDancing module
https://learning.flatironschool.com/courses/5286/assignments/172694?module_item_id=376688
This section needs the actual 'require_relative' statement to be more clear:
Note: remember to require the fancy_dance.rb file inside the dancer.rb and kid.rb, just like we did with our other file requirements.
No response
Changed Section:
Note: remember to require the fancy_dance.rb file inside the dancer.rb and kid.rb, just like we did with our other file requirements.
Inside 'dancer.rb' and 'kid.rb':
require_relative './fancy_dance.rb'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.