Skip to content

Instantly share code, notes, and snippets.

@Odaeus
Created June 7, 2016 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Odaeus/2f6fa6c82b454ddc728f4ed46a108566 to your computer and use it in GitHub Desktop.
Save Odaeus/2f6fa6c82b454ddc728f4ed46a108566 to your computer and use it in GitHub Desktop.
require "yaks"
Book = Struct.new(:title, :author)
book = Book.new("Leviathan Wakes", "James A Corey")
class BookMapper < Yaks::Mapper
type :book
attributes :title
end
yaks = Yaks.new do
default_format :json_api
end
puts yaks.call(book)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment