Class: Ethel::Source

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/ethel/source.rb

Direct Known Subclasses

Ethel::Sources::CSV

Instance Method Summary collapse

Instance Method Details

#allObject



24
25
26
# File 'lib/ethel/source.rb', line 24

def all
  to_a
end

#eachObject

Raises:

  • (NotImplementedError)


9
10
11
# File 'lib/ethel/source.rb', line 9

def each
  raise NotImplementedError
end

#field_namesObject



13
14
15
# File 'lib/ethel/source.rb', line 13

def field_names
  schema.collect(&:first)
end

#fieldsObject



17
18
19
20
21
22
# File 'lib/ethel/source.rb', line 17

def fields
  @fields ||= schema.inject({}) do |hash, (name, options)|
    hash[name] = Field.new(name, options)
    hash
  end
end

#schemaObject

Raises:

  • (NotImplementedError)


5
6
7
# File 'lib/ethel/source.rb', line 5

def schema
  raise NotImplementedError
end