Last active
March 26, 2017 13:58
-
-
Save flash-gordon/191c386e00d1ca1d38b45e58cfdb8d41 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
users: | |
- name: 'Jane' | |
email: '[email protected]' | |
- name: 'John' | |
email: '[email protected]' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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