Module: ROM::CSV

Defined in:
lib/rom/csv/gateway.rb,
lib/rom/csv/dataset.rb,
lib/rom/csv/version.rb,
lib/rom/csv/relation.rb,
lib/rom/csv/commands/create.rb,
lib/rom/csv/commands/delete.rb,
lib/rom/csv/commands/update.rb

Overview

CSV support for ROM

**Note: rom-csv is read only at the moment.**

Examples:

require 'rom/csv'
require 'ostruct'

setup = ROM.setup(:csv, "./spec/fixtures/users.csv")
setup.relation(:users) do
  def by_name(name)
    dataset.find_all { |row| row[:name] == name }
  end
end

class User < OpenStruct
end

setup.mappers do
  define(:users) do
    model User
  end
end

rom = setup.finalize
p rom.read(:users).by_name('Jane').one
# => #<User id=2, name="Jane", email="jane@doe.org">

Defined Under Namespace

Modules: Commands Classes: Dataset, Gateway, Relation

Constant Summary collapse

VERSION =
'0.4.0'.freeze