rendaku 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +41 -1
- data/lib/rendaku/version.rb +1 -1
- data/lib/rendaku.rb +2 -2
- data/rendaku.gemspec +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14aecdb69c1ecc2eade7a6db74083f5effdaa35b
|
4
|
+
data.tar.gz: 581bf0344d0c774da2a2ad7674b539a8ad547829
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77a3273edec8bb2d8cb1ed6786f14c653c04f9f73b1beb58d2ec9a865167cbb3ea400517e3803e39e81ee69ceaf5d34d0484a9a57b8f9db23b2c01c36feea414
|
7
|
+
data.tar.gz: cdd37879ef5effd767002aaaf7e5995fee3ac17d868083da6c6b2d9670a4b78c42667578d91971e572d354373e7aeda9f5cf074127dd6a30c39a0d18619786da
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -3,9 +3,49 @@
|
|
3
3
|
Rendaku is a ruby gem which accepts book dimensions and a simple image file for
|
4
4
|
generating book art page-folding instructions.
|
5
5
|
|
6
|
-
![
|
6
|
+
![book-folding art by my wife](https://i.imgur.com/9KTDiUG.png)
|
7
|
+
|
7
8
|
|
8
9
|
Inspired by the work at https://github.com/Moini/BookArtGenerator
|
9
10
|
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'rendaku'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
```shell
|
22
|
+
bundle
|
23
|
+
```
|
24
|
+
|
25
|
+
Or install it locally:
|
26
|
+
|
27
|
+
```shell
|
28
|
+
gem install rendaku
|
29
|
+
```
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
book_first_page = 2
|
35
|
+
book_last_page = 300
|
36
|
+
book_height_in_cm = 18 # or inches
|
37
|
+
book = Rendaku::Book.new book_first_page, book_last_page, book_height_in_cm
|
38
|
+
|
39
|
+
# image can be of jpeg, gif, or png format,
|
40
|
+
# but should be a simple black & white image for best results
|
41
|
+
image = Rendaku::Image::read('/path/to/file.png').first
|
42
|
+
|
43
|
+
pattern = Rendaku::Pattern.new book, image
|
10
44
|
|
45
|
+
pattern.book #=> #<Rendaku::Book:0x007fde931e03b0 @first_page=2, @last_page=300, @height=18>
|
46
|
+
pattern.image #=> /path/to/file.png PNG 629x1241=>150x1800 150x1800+0+0 DirectClass 8-bit
|
11
47
|
|
48
|
+
# the template outputs a list of page numbers and associated folds
|
49
|
+
# measured from the bottom of the page
|
50
|
+
pattern.template #=> [[{ :page => 2, :top => 6.04, :bottom => 6.08 }],[{ :page => 4, :top => 6.02, :bottom => 6.11 }]]
|
51
|
+
```
|
data/lib/rendaku/version.rb
CHANGED
data/lib/rendaku.rb
CHANGED
@@ -26,9 +26,9 @@ module Rendaku
|
|
26
26
|
def fold_template pattern
|
27
27
|
template = []
|
28
28
|
pattern.each_with_index do |contents, col|
|
29
|
-
top_corner
|
29
|
+
top_corner = contents[0][:start]
|
30
30
|
bottom_corner = contents[0][:end]
|
31
|
-
page
|
31
|
+
page = (col*2) + @book.first_page
|
32
32
|
|
33
33
|
template << { page: page, top: top_corner, bottom: bottom_corner }
|
34
34
|
end
|
data/rendaku.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rendaku
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Anderson
|
@@ -52,7 +52,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
52
52
|
requirements:
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: 1.9.3
|
56
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - ">="
|