Skip to content

Instantly share code, notes, and snippets.

@flash-gordon
Last active March 26, 2017 13:58
Show Gist options
  • Save flash-gordon/191c386e00d1ca1d38b45e58cfdb8d41 to your computer and use it in GitHub Desktop.
Save flash-gordon/191c386e00d1ca1d38b45e58cfdb8d41 to your computer and use it in GitHub Desktop.
users:
- name: 'Jane'
email: 'jane@doe.org'
- name: 'John'
email: 'john@acme.com'
require 'rom-yaml'
class Users < ROM::Relation[:yaml]
dataset :users
schema do
attribute :name, ROM::Types::String
attribute :email, ROM::Types::String
end
end
rom = ROM.container(:yaml, File.join(__dir__, 'data.yml')) do |c|
c.register_relation(Users)
end
# rom = ROM.container(:yaml, File.join(__dir__, 'data.yml')) do |c|
# c.relation(:users) do
# schema do
# attribute :name, ROM::Types::String
# attribute :email, ROM::Types::String
# end
# end
# end
p rom.relation(:users).to_a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment