Sha256: 708956e00ea0dc064d40afe92ed0ae191e1a4c49e2df72c41e56e670390aed03

Contents?: true

Size: 815 Bytes

Versions: 19

Compression:

Stored size: 815 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

require "enumerator"

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.
  #
  # TODO since 1.8, this is part of the standard library, I should rewrite vPim
  # so this can be removed.
  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

19 entries across 19 versions & 11 rubygems

Version Path
fraser-vpim-0.658 lib/vpim/enumerator.rb
fraser-vpim-0.659 lib/vpim/enumerator.rb
fraser-vpim-rails-0.658 lib/vpim/enumerator.rb
fraser-vpim-rails-0.659 lib/vpim/enumerator.rb
xing-vpim-0.658.1 lib/vpim/enumerator.rb
vpim2-0.0.1 lib/vpim/enumerator.rb
vpim-rails-reinteractive-0.7 lib/vpim/enumerator.rb
vpim-rails-0.665 lib/vpim/enumerator.rb
thoughtafter-vpim-0.7.0.1 lib/vpim/enumerator.rb
vpim-rails-0.664 lib/vpim/enumerator.rb
vpim-rails-0.663 lib/vpim/enumerator.rb
vpim-rails-0.662 lib/vpim/enumerator.rb
scashin133-vpim-9.4.0 lib/vpim/enumerator.rb
vpim-rails-0.661 lib/vpim/enumerator.rb
mumboe-vpim-0.7 lib/vpim/enumerator.rb
mumboe-vpim-0.695 lib/vpim/enumerator.rb
fairtilizer-vpim-0.695 lib/vpim/enumerator.rb
vpim-0.658 lib/vpim/enumerator.rb
vpim-0.695 lib/vpim/enumerator.rb