quilt 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/examples/gen.rb +18 -0
- data/lib/quilt.rb +8 -3
- metadata +4 -4
data/Rakefile
CHANGED
@@ -18,7 +18,7 @@ DESCRIPTION = "a library for generating identicon."
|
|
18
18
|
RUBYFORGE_PROJECT = "quilt"
|
19
19
|
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
20
20
|
BIN_FILES = %w( )
|
21
|
-
VERS = "0.0.
|
21
|
+
VERS = "0.0.5"
|
22
22
|
|
23
23
|
REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
|
24
24
|
CLEAN.include ['**/.*.sw?', '*.gem', '.config']
|
data/examples/gen.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
require 'rubygems'
|
2
3
|
|
3
4
|
#require 'quilt'
|
@@ -24,3 +25,20 @@ icon.write "file/motemen100.png"
|
|
24
25
|
icon = Quilt::Identicon.new 'motemen', :size => 150
|
25
26
|
icon.write "file/motemen150.png"
|
26
27
|
|
28
|
+
icon = Quilt::Identicon.new 'ああ', :size => 150
|
29
|
+
icon.write "file/aa.png"
|
30
|
+
|
31
|
+
=begin
|
32
|
+
Encoding.default_internal = Encoding.default_external
|
33
|
+
p [Encoding.default_external, Encoding.default_internal]
|
34
|
+
|
35
|
+
s = "\x89"
|
36
|
+
s.force_encoding('ASCII-8BIT')
|
37
|
+
p [s, s.encoding]
|
38
|
+
open('aa', 'wb') { |f|
|
39
|
+
p f.external_encoding
|
40
|
+
p f.internal_encoding
|
41
|
+
f.write s
|
42
|
+
}
|
43
|
+
=end
|
44
|
+
# str.force_encoding('ASCII-8BIT')
|
data/lib/quilt.rb
CHANGED
@@ -35,7 +35,7 @@ module Quilt
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def write path
|
38
|
-
open(path, '
|
38
|
+
open(path, 'wb') {|f| f.write @image.to_blob }
|
39
39
|
end
|
40
40
|
|
41
41
|
def to_blob
|
@@ -234,8 +234,13 @@ module Quilt
|
|
234
234
|
end
|
235
235
|
|
236
236
|
def self.extract_code list
|
237
|
-
|
238
|
-
|
237
|
+
if list.respond_to? :getbyte
|
238
|
+
tmp = [list.getbyte(0) << 24, list.getbyte(1) << 16,
|
239
|
+
list.getbyte(2) << 8, list.getbyte(3)]
|
240
|
+
else
|
241
|
+
tmp = [list[0].to_i << 24, list[1].to_i << 16,
|
242
|
+
list[2].to_i << 8, list[3].to_i]
|
243
|
+
end
|
239
244
|
tmp.inject(0) do |r, i|
|
240
245
|
r | ((i[31] == 1) ? -(i & 0x7fffffff) : i)
|
241
246
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quilt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- swdyh
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-04-29 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|