Giter Club home page Giter Club logo

Comments (6)

rvictorino avatar rvictorino commented on June 25, 2024 1

@K-Sato1995 both missing «r» have been fixed by the linked PR (#10 ).

However, executing :

SpellGenerator::Generator.new.self_generate('Random' 'Fire')

Outputs RandomFire, not Random Fire (notice the missing space between words).

I'm not a Ruby dev, so I may be missing some key point or syntactic sugar but adding a comma between both strings seems to help 😄

I guess, since this issues has been partially fixed, it would be logical to reopen it but maybe you would prefer that I open a new one focusing on the comma thing ?

from spell_generator.

K-Sato1995 avatar K-Sato1995 commented on June 25, 2024

This would be a great first issue as well!!
Thanks @rvictorino !!

from spell_generator.

K-Sato1995 avatar K-Sato1995 commented on June 25, 2024

Closing the issue since it was fixed here.

@rvictorino
Thanks for opening the issue😇!!

from spell_generator.

K-Sato1995 avatar K-Sato1995 commented on June 25, 2024

@rvictorino
Hi! Thanks for this 😊!!
In ruby, you need to put , between each argument. Otherwise, Ruby's interpreter recognizes it as one string like in the example below.

# This method is expecting to get 2 arguments when it's called. 
def test(a,b)
  p "#{a} and #{b}" 
end

test('string1', 'string2') #=> "string1 and string2" # Got 2 arguments as expected.
test('string1'  'string2') #=> wrong number of arguments (given 1, expected 2) # Ruby treat it as if only one string was passed.

That said, it is wired it didn't raise any error and output RandomFire. I specified to raise an error when only one value is passed to the method here.

I just created examples/spells.rb. Can you check if you can reproduce the same case using the example??

You can run the code by following the steps below in your terminal.

cd spell_generator // move to this project's directory
ruby examples/spells.rb

from spell_generator.

rvictorino avatar rvictorino commented on June 25, 2024

Hi, it's me, again !

yeah, I knew I saw something about checking number of arguments in the source code; that's what bugged me.

I can reproduce !
In the example spells file, there is a comma between arguments, so it works !

When I remove the comma, I get RandomFire (no space).

To sum things up, here are the code / outputs pairs I tested:

SpellGenerator::Generator.new.self_generate('Random', 'Fire') #=> Random Fire
SpellGenerator::Generator.new.self_generate('RandomFire') #=> RandomFire
SpellGenerator::Generator.new.self_generate('Random' 'Fire') #=> RandomFire
  • First one is what's expected
  • Second one is just one argument. Shouldn't it fire something / not work?
  • Same for the third line, except the only argument is split in two strings.

So two things:

  • As stated in this issue, README needs to be updated to reflect a working usage with two arguments: add a comma between Random and Fire.
  • There might be some unexpected behavior when this method is used with only one argument: Should I create a new issue to explain it separately?

Thanks again for those great explanations about ruby @K-Sato1995 !! 🤓 😃

from spell_generator.

K-Sato1995 avatar K-Sato1995 commented on June 25, 2024

Hi @rvictorino !
I really appreciate your thorough review of this project!!
It's always good to have a more experienced programmer like yourself looking over a project👏.

As stated in this issue, README needs to be updated to reflect a working usage with two arguments: add a comma between Random and Fire.

Yes for sure! The part about #self_generate in README.md is definitely not correct rn🙇🏼‍♀️.

There might be some unexpected behavior when this method is used with only one argument: Should I create a new issue to explain it separately?

Originally the expected behavior is to raise the original SpellGeneratorError when only one argument is passed to the method.
I would really appreciate if you open issues for those problems respectively🙇🏼‍♀️.

Thanks again!!! I truly appreciate your cooperation🥇!

from spell_generator.

Related Issues (11)

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.