Comments (6)
@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.
This would be a great first issue as well!!
Thanks @rvictorino !!
from spell_generator.
Closing the issue since it was fixed here.
@rvictorino
Thanks for opening the issue😇!!
from spell_generator.
@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.
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
andFire
. - 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.
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)
- Add more spells
- Missing comma in README
- self_generate misuse should raise an Error
- Rename constants for clarity HOT 2
- Removing a noun from SPELL_VERBS
- Include the travis build status image in the README HOT 3
- Gemfile.lock isn't up to date, causing Travis Build to crash. HOT 1
- README link to CODE_OF_CONDUCT is broken.
- Reorganize words sets HOT 8
- Given output does not match code execution in README usage section HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spell_generator.