Sha256: 93b084b34b1af6f0e5e2c7c030f39225bcc4db5b38148d462609f18c17d62166

Contents?: true

Size: 334 Bytes

Versions: 2

Compression:

Stored size: 334 Bytes

Contents

module Of
  METHOD = proc do
    def of(klass=nil, &block)
      klass || block || raise(ArgumentError, 'must provide a `Class` or block')
      block || klass.respond_to?(:new) || raise(ArgumentError, 'class must respond to `.new`')
      block = proc { klass.new } if klass.is_a? Class
      self.times.map(&block)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
of-0.4.0 lib/of/method.rb
of-0.3.0 lib/of/method.rb