6 kyu
EventEmitter
160Lordnibbler
Loading description...
Data Structures
Arrays
Algorithms
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
This comment has been hidden.
It's a good kata. I had to read the description several times before I got it.
Maybe "you must be able to subscribe n number of blocks to the same key" could be "you must be able to subscribe multiple blocks to the same key"
This comment has been hidden.
Added this test! Thanks @joshbrodienz!
Awesome!
!
I seem to have the only solution which returns the Procs but doesn't explicitly call() them?
Which was the intended behaviour, returning an array of Procs or an array of the results?
This comment has been hidden.
I like the kata. I seem to remember seeing a similar one for JavaScript before. However, it isn't clear what the trigger method is supposed to do and return.
The description says that the blocks for the event should be called and if there are not blocks for an event, nil or an empty array should be returned. It says nothing on what to return when there are blocks. (It could be nothing, the return values of the blocks as an array, or the blocks themselves).
Looking at the test cases, the last test case checks that the actual blocks are returned and not the results. Actually, just returning the blocks without executing them passes the tests as well.
I have updated the kata per your comments above. Can you take another look? I think its much clearer now, and have added back in the additional tests to make the solution more strict.
I think it's much clearer now.
However, your second test case doesn't seem to check for a block, but for the value of the called block.
How do you suggest I update it? That test was just to ensure that a block was saved in the EventEmitter and could be called.