Remix.run Logo
kaiuhl 14 hours ago

Blocks are actually instances of the Proc class. There are helper methods to handle blocks passed to methods in a lightweight manner but you can also accept the block as a method argument, e.g.,

  class Integer
    def times(&blk)
      i = 0
      while i < self
        blk.call(i)
        i += 1
      end
    end
  end