Skip to content

Instantly share code, notes, and snippets.

class MySet
end
require 'minitest/autorun'
class TestMySet < Minitest::Test
def test_empty_set_should_have_size_0
end
def test_initialize_with_an_array
end

Ruby and General Programming:

  • What is a class? What is an object? What are the differences in Ruby?

  • Are instance variables available to class methods?

  • What are the differences between blocks, procs and lambdas in Ruby?

  • Write a method that sorts the keys in a hash by the length of the key as a string. For instance, the hash:

    { abc: 'hello', 'another_key' => 123, 4567 => 'third' }

String

::new
*
+
<<
<=>
==
=~

Hash

==
[key]
[key]=
any?
any? {|key, value| ...}
delete(key)
delete(key) {|key| ..}

Array

::new
*
+
-
<=>
==
<<