Created
January 25, 2016 22:10
-
-
Save TheNotary/514f1fb39637a520113b to your computer and use it in GitHub Desktop.
This file contains 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 'kindler' | |
require 'ostruct' | |
book = Kindler::Book.new title: "Cool Magazine" | |
book.mobi_type = :magzine | |
# articles = Article.all | |
a1 = OpenStruct.new({ "title" => "My Important News", "author" => "Max", "content" => "Bla bla bla bla bla", "section" => "News" }) | |
a2 = OpenStruct.new({ "title" => "My Irrelivant News", "author" => "Max", "content" => "Bla bla bla bla bla", "section" => "News" }) | |
a3 = OpenStruct.new({ "title" => "My Interesting Story", "author" => "Max", "content" => "Bla bla bla bla bla", "section" => "Stories" }) | |
a4 = OpenStruct.new({ "title" => "My Boring Story that No One Wants to Hear", "author" => "Max", "content" => "Bla bla bla bla bla", "section" => "Stories" }) | |
articles = [a1, a2, a3, a4] | |
articles.each do |article| | |
opts = { | |
title: article.title, | |
author: article.author, | |
content: article.content, | |
section: article.section | |
} | |
book.add_article(opts) | |
end | |
book.generate | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment