Sha256: 84a32881c31b5a6c56781472ffdb2467db7884ab00adc381b8419f2c65384861

Contents?: true

Size: 304 Bytes

Versions: 10

Compression:

Stored size: 304 Bytes

Contents

class Integer

  # Like #times but returns a collection of the yield results.
  #
  #   a = 3.of { |i| "#{i+1}" }
  #   a #=> [ "1", "2", "3" ]
  #

  def of(&block)
    Array.new(self, &block)
  end

  # Time warn aliases for #of.
  alias_method :times_collect, :of
  alias_method :times_map, :of

end

Version data entries

10 entries across 9 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 lib/core/facets/integer/of.rb
facets-3.1.0 lib/core/facets/integer/of.rb
facets-3.0.0 lib/core/facets/integer/of.rb
facets-2.9.3 lib/core/facets/integer/of.rb
facets-2.9.2 lib/core/facets/integer/of.rb
facets-2.9.2 src/core/facets/integer/of.rb
facets-2.9.1 lib/core/facets/integer/of.rb
facets-2.9.0 lib/core/facets/integer/of.rb
facets-2.9.0.pre.2 lib/core/facets/integer/of.rb
facets-2.9.0.pre.1 lib/core/facets/integer/of.rb