Coder Social home page Coder Social logo

phase-3-ruby-oo-inheritance-modules's Issues

Not clear how to do "We can call"

Canvas Link

https://learning.flatironschool.com/courses/5187/assignments/180355?module_item_id=397998

Concern

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.)

Additional Context

No response

Suggested Changes

I should probably know how/where to invoke the "We can call" stuff, but, well,...

File Path To 'fancy_dance.rb' Is Needed

Canvas Link

https://learning.flatironschool.com/courses/5286/assignments/172694?module_item_id=376688

Concern

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

Additional Context

No response

Suggested Changes

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

typo

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.


Link to Canvas

https://learning.flatironschool.com/courses/4214/assignments/135694?module_item_id=281489

Add a link to the assignment in Canvas here.

What should be changed?

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.

Additional context

Add any other context about the problem here.

Needs A Reference To The 'namespace resolution operator'

Canvas Link

https://learning.flatironschool.com/courses/5286/assignments/172694?module_item_id=376688

Concern

This section needs to have a reference to the actual 'namespace resolution operator':

We refer to the namespaced modules or classes with ::

Additional Context

No response

Suggested Changes

Changed Section:

We refer to the namespaced modules or classes with '::', the 'namespace resolution operator'.

Reference:

Unable to pass tests where indicated to run learn test in code along

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.


Link to Canvas

Add a link to the assignment in Canvas here.
https://learning.flatironschool.com/courses/4214/assignments/135694?confetti=true&submitted=0

What should be changed?

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".

Additional context

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:

  1. Dancer includes the Dance module
    Failure/Error: (actual.is_a? FancyDance::InstanceMethods) || (actual.is_a? Dance)

    NameError:
    uninitialized constant FancyDance

    ./spec/spec_helper.rb:9:in `block (2 levels) in <top (required)>'

    ./spec/dancer_spec.rb:6:in `block (2 levels) in <top (required)>'

  2. Dancer extends the MetaDancing module
    Failure/Error: (actual.is_a? FancyDance::ClassMethods) || (actual.is_a? MetaDancing)

    NameError:
    uninitialized constant FancyDance

    ./spec/spec_helper.rb:15:in `block (2 levels) in <top (required)>'

    ./spec/dancer_spec.rb:15:in `block (2 levels) in <top (required)>'

  3. Kid includes the Dance module
    Failure/Error: (actual.is_a? FancyDance::InstanceMethods) || (actual.is_a? Dance)

    NameError:
    uninitialized constant FancyDance

    ./spec/spec_helper.rb:9:in `block (2 levels) in <top (required)>'

    ./spec/kid_spec.rb:6:in `block (2 levels) in <top (required)>'

  4. Kid extends the MetaDancing module
    Failure/Error: (actual.is_a? FancyDance::ClassMethods) || (actual.is_a? MetaDancing)

    NameError:
    uninitialized constant FancyDance

    ./spec/spec_helper.rb:15:in `block (2 levels) in <top (required)>'

    ./spec/kid_spec.rb:15:in `block (2 levels) in <top (required)>'

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

Needs Reference To Actual 'require_relative' Import Statement

Canvas Link

https://learning.flatironschool.com/courses/5286/assignments/172694?module_item_id=376688

Concern

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.

Additional Context

No response

Suggested Changes

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'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.