Sha256: 8079de81bac5bb9a66920165b7aeeefc5f24847057ade5105591c6aa42bfbca1

Contents?: true

Size: 681 Bytes

Versions: 4

Compression:

Stored size: 681 Bytes

Contents

=begin
  Copyright (C) 2008 Sam Roberts

  This library is free software; you can redistribute it and/or modify it
  under the same terms as the ruby language itself, see the file COPYING for
  details.
=end

module Vpim
  # This is a way for an object to have multiple ways of being enumerated via
  # argument to it's #each() method. An Enumerator mixes in Enumerable, so the
  # standard APIS such as Enumerable#map(), Enumerable#to_a(), and
  # Enumerable#find_all() can be used on it.
  class Enumerator
    include Enumerable

    def initialize(obj, *args)
      @obj = obj
      @args = args
    end

    def each(&block)
      @obj.each(*@args, &block)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vpim-0.619 lib/vpim/enumerator.rb
vpim-0.597 lib/vpim/enumerator.rb
vpim-0.602 lib/vpim/enumerator.rb
vpim-0.604 lib/vpim/enumerator.rb