Class: Tracksperanto::YieldNonEmpty
- Inherits:
-
Object
- Object
- Tracksperanto::YieldNonEmpty
- 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
- #each ⇒ Object
-
#initialize(obj) ⇒ YieldNonEmpty
constructor
A new instance of YieldNonEmpty.
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
#each ⇒ Object
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 |