fake_picture 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/fake_picture/avatar/avatar.rb +1 -1
- data/lib/fake_picture/blog/blog.rb +1 -1
- data/lib/fake_picture/people/people.rb +1 -1
- data/lib/fake_picture/version.rb +1 -1
- data/lib/fake_picture.rb +7 -3
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a9aee13ffffb6146fb529b09d317c3137e637855ad8bbb573e6c96cc02f3afbf
|
|
4
|
+
data.tar.gz: a8d75765bffbebab69148306c2a6eb10d3cfa4907b81a0977108e317cbb0a886
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a6ccef4cad6746581936e08384d41207318fdf3236c02cc2f52c2527a86842ed75fe8657975cd4ea329d8126071809b88611c43426f77e72577523484afc509
|
|
7
|
+
data.tar.gz: 692c1b965f8adc957ebb06bc38aceabc309379c6e2f9b647e05e9eb2cac34232cd8a5d1cb072dee828e9292de0eec532a4cba02e8e3eb7aab9314848c28f0e0f
|
data/README.md
CHANGED
|
@@ -58,6 +58,14 @@ You can also call a method `file` with method name of this class if you wanna ge
|
|
|
58
58
|
FakePicture::People.file(:man) #=> #<File:/Users/xi-master/Workplace/fake_picture/lib/fake_picture/avatar/pack/man-6.svg>
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
+
#### As Base64:
|
|
62
|
+
|
|
63
|
+
You can also call a method `base64` with a method name of this class if you want to get the picture as a base64 encoded file for might be sending it somewhere, like this:
|
|
64
|
+
|
|
65
|
+
```ruby
|
|
66
|
+
FakePicture::People.base64(:man) #=> ""/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAwICQoJBwwKCgoNDQwOEh4TEhAQ\nEiQaGxUeKyYtLComKSkvNUQ6L.."
|
|
67
|
+
```
|
|
68
|
+
|
|
61
69
|
#### In factories:
|
|
62
70
|
|
|
63
71
|
```ruby
|
data/lib/fake_picture/version.rb
CHANGED
data/lib/fake_picture.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
require 'base64'
|
|
2
3
|
|
|
3
4
|
module FakePicture
|
|
4
5
|
class Base
|
|
@@ -11,10 +12,10 @@ module FakePicture
|
|
|
11
12
|
end
|
|
12
13
|
|
|
13
14
|
# def download(query)
|
|
14
|
-
#TODO: make downloading pictures to gem
|
|
15
|
+
#TODO: make downloading pictures to gem by a service: https://source.unsplash.com/random/<width>x<height>
|
|
15
16
|
# end
|
|
16
17
|
|
|
17
|
-
def self.
|
|
18
|
+
def self.initialize_methods(*method_names, new_random_method_name: nil) # from line 17 to 24 make code better
|
|
18
19
|
path_to_pack = "#{__dir__}/fake_picture/#{self.name.split('::').last.downcase}/pack"
|
|
19
20
|
|
|
20
21
|
self.superclass.check_pack_directory_readiness(path_to_pack)
|
|
@@ -26,12 +27,15 @@ module FakePicture
|
|
|
26
27
|
define_singleton_method :"#{name}" do
|
|
27
28
|
self.superclass.random_file("#{path_to_pack + selector}")
|
|
28
29
|
end
|
|
29
|
-
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
define_singleton_method :file do |method_name|
|
|
33
33
|
File.new(self.send(method_name))
|
|
34
34
|
end
|
|
35
|
+
|
|
36
|
+
define_singleton_method :base64 do |method_name|
|
|
37
|
+
Base64.encode64(File.read(self.send(method_name)))
|
|
38
|
+
end
|
|
35
39
|
end
|
|
36
40
|
|
|
37
41
|
private
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fake_picture
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- loqimean
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-06-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: debug
|
|
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
144
144
|
- !ruby/object:Gem::Version
|
|
145
145
|
version: '0'
|
|
146
146
|
requirements: []
|
|
147
|
-
rubygems_version: 3.
|
|
147
|
+
rubygems_version: 3.3.7
|
|
148
148
|
signing_key:
|
|
149
149
|
specification_version: 4
|
|
150
150
|
summary: fake pictures
|