RB139: Practice Examples
·3 mins
Blocks #
- What are closures?
- What are blocks?
- What are Procs and lambdas? How are they different?
- How do closures interact with variable scope?
- What are blocks used for? Give examples of specific use cases
- How do we write methods that take a block? What errors and pitfalls can arise from this and how do we avoid them?
- How do we utilize the return value of a block? How can methods that take a block pass pieces of data to that block?
- What is Symbol#to_proc and how is it used?
- How do we specific a block argument explicitly?
- How can we return a Proc from a method or block?
- What is arity? What kinds of things in Ruby exhibit arity? Give explicit examples.
Testing #
- What is Minitest? How do we get access to it?
- What are the different styles of Minitest?
- What is RSpec? How does it differ from Minitest?
- What is a test suite? What is a test?
- What are assertions? How do they work?
- Give some examples of common assertions and how they are used.
- What is the SEAT approach?
- What is code coverage and how is it used? What tools can you use to gauge code coverage for yourself?
Core Ruby Tools #
- What are RubyGems? How are they used? Where can you find them? How do you manage them in your own environment? How do you include them in projects you create?
- What is the RubyGems format for projects?
- What are Ruby Version Managers? Why do we need them? Give some examples of available Ruby Version Managers and what they can do for you.
- What is Bundler? What does it do and why is it useful?
- What is Rake? What does it do and why is it useful?
- What is a .gemspec file?
- How do the Ruby tools relate to one another?
Regex #
- What are patterns?
- How do you define a regex?
- What is concatenation in regex? How is it achieved?
- What is alternation in regex? How is it achieved?
- What are a few examples of the most basic kind of regex patterns?
- What is a meta-character? How do you deal with them in regex? List a few examples.
- What is a character class? How are they created? Give specific examples.
- How are meta-characters different inside and outside of a character class?
- What is an anchor? What, specifically, do you have to watch out for with anchors when it comes to Ruby regex?
- What is a quantifier? How do they operate? Give explicit examples.
- What is a capture group and how is it used?
- How do you test a string against a regex?
- How can you split strings into multiple items with a regex?
- How do you construct new strings from existing strings?