hako / blackboard-dl

📚💻 Downloads lectures and workshops automagically.
MIT License
8 stars 3 forks source link

Array#at no longer a valid method #4

Closed ocelotsloth closed 4 years ago

ocelotsloth commented 4 years ago

Expected Behavior

crystal build src/blackboard-dl.cr should build the application.

Actual Behavior

~/Projects/blackboard-dl master*.
❯ crystal build src/blackboard-dl.cr
Showing last frame. Use --error-trace for full trace.

In src/cli.cr:230:30

 230 | @@college = colleges.find(idx.to_s.to_i)
                            ^---
Error: 'Array(Hash(String, String))#find' is expected to be invoked with a block, but no block was given

Versions

OS: Arch Linux Crystal Version:

❯ crystal -v
Crystal 0.32.1 (2019-12-18)

LLVM: 9.0.0
Default target: x86_64-pc-linux-gnu

Thoughts

It looks like Iterables#at was removed at some point. I'm unfamiliar with Crystal as a language but I'm looking to see what the appropriate change is. I'm looking at the Iterables#values_at method right now but getting an error:

Error: class variable '@@college' of BlackBoard::Dl must be Hash(String, String), not Tuple(Hash(String, String))

I think I just need to get the values_at return value cast to a single value. I should have an answer pretty quickly.