Module: ROM::EnumerableDataset

Extended by:
DataProxy::ClassMethods
Includes:
Enumerable
Included in:
ArrayDataset
Defined in:
core/lib/rom/enumerable_dataset.rb

Overview

A helper module that adds data-proxy behavior to an enumerable object

This module is intended to be used by gateways

Class that includes this module can define row_proc class method which must return a proc-like object which will be used to process each element in the enumerable

Examples:

class MyDataset
  include ROM::EnumerableDataset

  def self.row_proc
    -> tuple { tuple.each_with_object({}) { |(k,v), h| h[k.to_sym] = v } }
  end
end

ds = MyDataset.new([{ 'name' => 'Jane' }, [:name])
ds.to_a # => { :name => 'Jane' }

Class Method Summary collapse

Class Method Details

.forward(*methods) ⇒ undefined Originally defined in module DataProxy::ClassMethods

Forward provided methods to the underlaying data object

Examples:


class MyDataset
  include DataProxy

  forward(:find_all, :map)
end

Returns:

  • (undefined)