img_return 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/img_return.rb +17 -15
- metadata +33 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4a91ac9673bca6c21a4b4f7c901865a0cd227f3
|
4
|
+
data.tar.gz: e8e0a7911411400a5d2e7d1fead5cf297babeaea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32a244d6dfb46938e9dcb5ae2ae1016bbe459c434e9ddaae946ad20f33735d37fedee9e3faaf6deffce623317ca35f9d413c09b97df6536dc60db46b5930097b
|
7
|
+
data.tar.gz: c77034d54d82c18e38a48fd9c0fe78de6a63a6283e3b36d5f4f3021ac68f92285dd58c0fa7d767f58352023266c5e82a4d007e3b7524f21b17106b5f622a60bd
|
data/lib/img_return.rb
CHANGED
@@ -4,41 +4,43 @@ module Return_Img
|
|
4
4
|
def self.random(arry)
|
5
5
|
random_img = Random.new
|
6
6
|
ri = random_img.rand(0...arry.size)
|
7
|
-
arry.each_index
|
8
|
-
|
9
|
-
|
7
|
+
arry.each_index do |ei|
|
8
|
+
@return_background_img = arry[ri] if ei == ri
|
9
|
+
end
|
10
|
+
|
10
11
|
return @return_background_img
|
11
12
|
end
|
13
|
+
|
12
14
|
def self.write(path, css_code)
|
13
|
-
File.open("#{path}.css", 'w')
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
def self.sassy_write(path, css_code, mode)
|
19
|
-
File.open("#{path}.css.scss", mode){|fp|
|
20
|
-
fp.puts(css_code)
|
21
|
-
}
|
15
|
+
File.open("#{path}.css", 'w') do |fp|
|
16
|
+
fp.puts(css_code)
|
17
|
+
end
|
18
|
+
|
22
19
|
return css_code
|
23
20
|
end
|
21
|
+
|
24
22
|
class Image
|
25
23
|
def list(dir)
|
26
24
|
images = []
|
27
25
|
FileUtils.cd(dir) do
|
28
|
-
Dir.entries(".").each
|
29
|
-
|
30
|
-
|
26
|
+
Dir.entries(".").each do |en|
|
27
|
+
images.push(en) if File.extname(en) == ".png" || File.extname(en) == ".jpg" || File.extname(en) == ".tiff"
|
28
|
+
end
|
31
29
|
end
|
30
|
+
|
32
31
|
return images
|
33
32
|
end
|
33
|
+
|
34
34
|
def write(img_path, css_file_path)
|
35
35
|
css_code = "body {
|
36
36
|
background-image: url('#{img_path}');
|
37
37
|
background-repeat:no-repeat;
|
38
38
|
background-size:cover;
|
39
39
|
}"
|
40
|
+
|
40
41
|
Return_Img.write(css_file_path, css_code)
|
41
42
|
end
|
43
|
+
|
42
44
|
def self.render_color_style(element, style, css_filename_path)
|
43
45
|
warn Kernel.caller.first + "render_color_style is a deprecated class method. Make your own with Return_Img.write()"
|
44
46
|
css_color_code = "#{element} {
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: img_return
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ralph Desir
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2016-01-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '10.4'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '10.4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.3'
|
13
41
|
description: Return_Img is a gem designed to return random images and colors. This
|
14
42
|
gem was created with the idea of returning a different image or color to a cascading
|
15
43
|
style sheet. For the effect of having a different image return to the browser ever
|
@@ -41,8 +69,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
41
69
|
version: '0'
|
42
70
|
requirements: []
|
43
71
|
rubyforge_project:
|
44
|
-
rubygems_version: 2.
|
72
|
+
rubygems_version: 2.5.1
|
45
73
|
signing_key:
|
46
74
|
specification_version: 4
|
47
75
|
summary: Image return.
|
48
76
|
test_files: []
|
77
|
+
has_rdoc:
|