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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/img_return.rb +17 -15
  3. metadata +33 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b663f4e1ebaa7767fafc10770cc988104e627988
4
- data.tar.gz: 26e930c542c7938a7778b1c8f46e9557c82fd63c
3
+ metadata.gz: f4a91ac9673bca6c21a4b4f7c901865a0cd227f3
4
+ data.tar.gz: e8e0a7911411400a5d2e7d1fead5cf297babeaea
5
5
  SHA512:
6
- metadata.gz: 2467b48a9b4fde7d8ab29dfa803bdab6ec2cfbe24f68d6f7e599cb214e851394b5484c53f3902433cb20fb72954a0065c0c06cdb22f0cb51ad9859f1baa65e37
7
- data.tar.gz: 387c8910ad670a7d26758a311d4bcab94b959f4cd845daef9731cc95270006fd9777820934d602eb7cfbdb755130a38867f467071217543ee8f51e9606d4f0c2
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{|ei|
8
- @return_background_img = arry[ri] if ei == ri
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'){|fp|
14
- fp.puts(css_code)
15
- }
16
- return css_code
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{|en|
29
- images.push(en) if File.extname(en) == ".png" || File.extname(en) == ".jpg" || File.extname(en) == ".tiff"
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.0.0
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: 2015-09-29 00:00:00.000000000 Z
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.4.8
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: