Class: Alf::Reader::Ruby

Inherits:
Alf::Reader show all
Defined in:
lib/alf/reader/ruby.rb

Overview

Specialization of the Reader contract for .rb files.

A .rb file/stream contains some ruby code that evaluates to a Relation-like object, typically an Array of hashes.

Constant Summary

Constants inherited from Alf::Reader

DEFAULT_OPTIONS

Instance Attribute Summary

Attributes inherited from Alf::Reader

#input, #options, #path

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Alf::Reader

by_mime_type, coerce, #initialize, reader, register, #to_s

Methods included from Support::Registry

#listen, #listeners, #register, #registered

Constructor Details

This class inherits a constructor from Alf::Reader

Class Method Details

.mime_typeObject



11
12
13
# File 'lib/alf/reader/ruby.rb', line 11

def self.mime_type
  nil
end

Instance Method Details

#each(&bl) ⇒ Object



15
16
17
18
# File 'lib/alf/reader/ruby.rb', line 15

def each(&bl)
  return to_enum unless block_given?
  ::Kernel.eval(input_text).each(&bl)
end