virtual_name_card 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/virtual_name_card/generator.rb +21 -3
- data/lib/virtual_name_card/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5e1371415cd7eb2a3dd26d90830e016067db401ce75695b610b9dad6f62c2b4
|
4
|
+
data.tar.gz: 17ee81052114ad7c53c30c866d7df80c87026e3deafbff70ccf022851fb7bda0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c9d83861f86d82e78f3666ec4b7f9ca5277b627dbd06c262a41b1d95068df03e977aa4ba608c315499ad96f7a6696ca4e9e0d49424c622cd28101052a9d8422
|
7
|
+
data.tar.gz: bab42e93dc03b94aea8439a631373d0ae4d15c3bf4d59dcb3ade120a18dcdc40b4a1c0521b017d98bb526a9572fa57be480b56822537a878a8f94b09163aeb11
|
@@ -5,7 +5,7 @@ module VirtualNameCard
|
|
5
5
|
GENERATED_FILE_PATH = File.expand_path("../../generated_file.png", __dir__)
|
6
6
|
|
7
7
|
class << self
|
8
|
-
def generate(name_kanji:, name_romaji:, role:, twitter_account: nil)
|
8
|
+
def generate(name_kanji:, name_romaji:, role:, email:, twitter_account: nil)
|
9
9
|
base_image_path =
|
10
10
|
if twitter_account
|
11
11
|
File.expand_path("../../base_images/with_twitter.jpg", __dir__)
|
@@ -17,7 +17,14 @@ module VirtualNameCard
|
|
17
17
|
|
18
18
|
name_kanji_combine(image: image, text: name_kanji)
|
19
19
|
name_romaji_combine(image: image, text: name_romaji)
|
20
|
-
|
20
|
+
|
21
|
+
if role
|
22
|
+
role_combine(image: image, text: role)
|
23
|
+
end
|
24
|
+
|
25
|
+
if email
|
26
|
+
email_combine(image: image, text: email)
|
27
|
+
end
|
21
28
|
|
22
29
|
if twitter_account
|
23
30
|
twitter_account_combine(image: image, text: twitter_account)
|
@@ -26,11 +33,12 @@ module VirtualNameCard
|
|
26
33
|
image
|
27
34
|
end
|
28
35
|
|
29
|
-
def write(name_kanji:, name_romaji:, role:, twitter_account: nil)
|
36
|
+
def write(name_kanji:, name_romaji:, role:, email:, twitter_account: nil)
|
30
37
|
image = generate(
|
31
38
|
name_kanji: name_kanji,
|
32
39
|
name_romaji: name_romaji,
|
33
40
|
role: role,
|
41
|
+
email: email,
|
34
42
|
twitter_account: twitter_account,
|
35
43
|
)
|
36
44
|
image.write GENERATED_FILE_PATH
|
@@ -66,6 +74,16 @@ module VirtualNameCard
|
|
66
74
|
end
|
67
75
|
end
|
68
76
|
|
77
|
+
private def email_combine(image:, text:)
|
78
|
+
image.combine_options do |config|
|
79
|
+
config.font File.expand_path("../../fonts/Noto_Sans_JP/NotoSansJP-Regular.otf", __dir__)
|
80
|
+
config.gravity "west"
|
81
|
+
config.pointsize 45
|
82
|
+
config.draw "text 170,217 '#{text}'"
|
83
|
+
config.fill "#000000"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
69
87
|
private def twitter_account_combine(image:, text:)
|
70
88
|
image.combine_options do |config|
|
71
89
|
config.font File.expand_path("../../fonts/Noto_Sans_JP/NotoSansJP-Medium.otf", __dir__)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: virtual_name_card
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michikawa Masayoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mini_magick
|