Class: Parqueteur::Input
- Inherits:
-
Object
- Object
- Parqueteur::Input
- Includes:
- Enumerable
- Defined in:
- lib/parqueteur/input.rb
Class Method Summary collapse
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(source) ⇒ Input
constructor
A new instance of Input.
Constructor Details
#initialize(source) ⇒ Input
Returns a new instance of Input.
13 14 15 16 17 18 19 |
# File 'lib/parqueteur/input.rb', line 13 def initialize(source) unless source.is_a?(Enumerable) raise ArgumentError, 'Enumerable object expected' end @source = source end |
Class Method Details
.from(arg) ⇒ Object
7 8 9 10 11 |
# File 'lib/parqueteur/input.rb', line 7 def self.from(arg) return arg if arg.is_a?(self) new(arg) end |
Instance Method Details
#each(&block) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/parqueteur/input.rb', line 21 def each(&block) if block_given? @source.each(&block) else @source.to_enum(:each) end end |