lorempixel_helper 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile.lock +1 -1
- data/lib/lorempixel_helper.rb +8 -6
- data/lib/lorempixel_helper/version.rb +1 -1
- data/spec/lorempixel_spec.rb +7 -3
- metadata +5 -13
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YWRjZjZjMTIxYWRkYTBhY2FjM2QwMWExOWE4YTQ0NjAzNjdlNmMyZg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MDY2ZTdlYzZiNTM0MDJiMTMxMjkyZGIwNWU3MGZkYjZkNmRmZjY1OQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZTUwNzVmOTA0YjdjY2VjNzNhZGU1MzkwMzcxMTgwNzE1YjYyMjczYThhOTBm
|
10
|
+
NzU2NDJjMDRiNTM3OTBiZDUyNDM3ZjQ1ZjAwM2EwMTBiNDk3ZmRjZGI2Y2Rm
|
11
|
+
ZmExZjhiODEyMTI0M2M5MDRiNDdkMjliZjRkMzQzNTQyNTkxMmE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NWMxZTA1NWJlMWE0MWRhZTY0MzdhNWQ4ZWQ0ZGRmNjkyZTZjYmNiYjhiNzNi
|
14
|
+
ZmIyZDYwNDk4ZGFmNmQ2ZDA4M2I5Njg3NWNmMTAyNjFhYzgyNmMxMGM2YmM1
|
15
|
+
NzcxNTU4NDIwMjllN2EwODJjM2Q4YTU2MTcxODU5NjMxMDViZDk=
|
data/Gemfile.lock
CHANGED
data/lib/lorempixel_helper.rb
CHANGED
@@ -12,17 +12,19 @@ module LorempixelHelper
|
|
12
12
|
:text => opts[:text].to_s.gsub(/\s+/, "-"),
|
13
13
|
:title => opts[:text] || "A lorempixel image",
|
14
14
|
:category => opts[:category],
|
15
|
-
:type => opts[:type]
|
15
|
+
:type => opts[:type],
|
16
|
+
:class => opts[:class]
|
16
17
|
}.merge!(opts)
|
17
18
|
|
18
19
|
src = "http://lorempixel.com/#{config[:width]}/#{config[:height]}"
|
19
|
-
|
20
|
+
style = 'lorempixel'
|
21
|
+
style = config[:class] if config[:class]
|
20
22
|
# lorempixel option
|
21
|
-
|
23
|
+
|
22
24
|
if config[:type]
|
23
25
|
src = "http://lorempixel.com/#{config[:type]}/#{config[:width]}/#{config[:height]}"
|
24
26
|
end
|
25
|
-
|
27
|
+
|
26
28
|
if config[:category]
|
27
29
|
src += "/#{config[:category]}"
|
28
30
|
if config[:item]
|
@@ -38,13 +40,13 @@ module LorempixelHelper
|
|
38
40
|
|
39
41
|
image_tag = "<img src='#{src}' alt='#{config[:alt]}' height='#{config[:height]}' width='#{config[:width]}'"
|
40
42
|
image_tag += " title='#{config[:title]}'"
|
41
|
-
image_tag += " class='
|
43
|
+
image_tag += " class='#{style}' />"
|
42
44
|
return image_tag.html_safe if defined?(Rails)
|
43
45
|
image_tag
|
44
46
|
end
|
45
47
|
|
46
48
|
alias :lorempixel :lorempixel_image_tag
|
47
|
-
|
49
|
+
|
48
50
|
end
|
49
51
|
end
|
50
52
|
|
data/spec/lorempixel_spec.rb
CHANGED
@@ -10,11 +10,11 @@ describe LorempixelHelper::ViewHelpers do
|
|
10
10
|
it "should accept a string" do
|
11
11
|
myview.lorempixel_image_tag("400").should == "<img src='http://lorempixel.com/400/400' alt='A lorempixel image' height='400' width='400' title='A lorempixel image' class='lorempixel' />"
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
it "should accept a integer" do
|
15
15
|
myview.lorempixel_image_tag(400).should == "<img src='http://lorempixel.com/400/400' alt='A lorempixel image' height='400' width='400' title='A lorempixel image' class='lorempixel' />"
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
it "should accept a componded WxH" do
|
19
19
|
myview.lorempixel_image_tag("400x200").should == "<img src='http://lorempixel.com/400/200' alt='A lorempixel image' height='200' width='400' title='A lorempixel image' class='lorempixel' />"
|
20
20
|
end
|
@@ -26,7 +26,7 @@ describe LorempixelHelper::ViewHelpers do
|
|
26
26
|
it "should accept category with custom text" do
|
27
27
|
myview.lorempixel_image_tag("400x200", :text=> 'Dummy-Text', :category=> "sports").should == "<img src='http://lorempixel.com/400/200/sports/Dummy-Text' alt='Dummy-Text' height='200' width='400' title='Dummy-Text' class='lorempixel' />"
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
it "should accept selected picture in category" do
|
31
31
|
myview.lorempixel_image_tag("400", :category=> "sports", :item => 2).should == "<img src='http://lorempixel.com/400/400/sports/2/' alt='A lorempixel image' height='400' width='400' title='A lorempixel image' class='lorempixel' />"
|
32
32
|
end
|
@@ -34,4 +34,8 @@ describe LorempixelHelper::ViewHelpers do
|
|
34
34
|
it "should accept selected picture in category with custom text" do
|
35
35
|
myview.lorempixel_image_tag("400", :text=> 'Dummy-Text', :category=> "sports", :item => 1).should == "<img src='http://lorempixel.com/400/400/sports/1/Dummy-Text' alt='Dummy-Text' height='400' width='400' title='Dummy-Text' class='lorempixel' />"
|
36
36
|
end
|
37
|
+
|
38
|
+
it "should accept a style class" do
|
39
|
+
myview.lorempixel_image_tag("400x200", :class => "test").should == "<img src='http://lorempixel.com/400/200' alt='A lorempixel image' height='200' width='400' title='A lorempixel image' class='test' />"
|
40
|
+
end
|
37
41
|
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lorempixel_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Prabu D
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-09-28 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rspec
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ! '>='
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -81,27 +74,26 @@ files:
|
|
81
74
|
homepage: https://github.com/spritlesoftware/lorempixel_helper
|
82
75
|
licenses:
|
83
76
|
- MIT
|
77
|
+
metadata: {}
|
84
78
|
post_install_message:
|
85
79
|
rdoc_options: []
|
86
80
|
require_paths:
|
87
81
|
- lib
|
88
82
|
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
83
|
requirements:
|
91
84
|
- - ! '>='
|
92
85
|
- !ruby/object:Gem::Version
|
93
86
|
version: '0'
|
94
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
-
none: false
|
96
88
|
requirements:
|
97
89
|
- - ! '>='
|
98
90
|
- !ruby/object:Gem::Version
|
99
91
|
version: '0'
|
100
92
|
requirements: []
|
101
93
|
rubyforge_project:
|
102
|
-
rubygems_version:
|
94
|
+
rubygems_version: 2.4.3
|
103
95
|
signing_key:
|
104
|
-
specification_version:
|
96
|
+
specification_version: 4
|
105
97
|
summary: A Rails view helper place an images via http://lorempixel.com
|
106
98
|
test_files:
|
107
99
|
- spec/lorempixel_spec.rb
|