Class: Tracksperanto::YieldNonEmpty

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/tracksperanto/yield_non_empty.rb

Overview

An Enumerable wrapper that will only yield non-empty elements

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ YieldNonEmpty

Returns a new instance of YieldNonEmpty.



6
7
8
# File 'lib/tracksperanto/yield_non_empty.rb', line 6

def initialize(obj)
  @obj = obj
end

Instance Method Details

#eachObject



10
11
12
13
14
# File 'lib/tracksperanto/yield_non_empty.rb', line 10

def each
  @obj.each do | item |
    yield(item) unless item.empty?
  end
end