sumitup 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/sumitup/parser.rb +5 -0
- data/spec/sumitup/parser_spec.rb +14 -0
- data/sumitup.gemspec +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/lib/sumitup/parser.rb
CHANGED
@@ -125,6 +125,11 @@ module Sumitup
|
|
125
125
|
end
|
126
126
|
|
127
127
|
def image_height(existing_height, existing_width, image_width_limit)
|
128
|
+
# if width is empty just set it to the default width
|
129
|
+
existing_width ||= image_width_limit
|
130
|
+
# if height is empty set it to width and then to the default width (not a lot of other options)
|
131
|
+
existing_height ||= existing_width
|
132
|
+
existing_height ||= image_width_limit
|
128
133
|
ratio = image_width_limit.to_f/existing_width.to_f
|
129
134
|
(existing_height.to_f * ratio).to_i
|
130
135
|
end
|
data/spec/sumitup/parser_spec.rb
CHANGED
@@ -168,6 +168,20 @@ describe Sumitup::Parser do
|
|
168
168
|
height = @parser.image_height(existing_height, existing_width, image_width_limit)
|
169
169
|
height.should == 105
|
170
170
|
end
|
171
|
+
it "should handle nil height" do
|
172
|
+
image_width_limit = 100
|
173
|
+
existing_height = nil
|
174
|
+
existing_width = 200
|
175
|
+
height = @parser.image_height(existing_height, existing_width, image_width_limit)
|
176
|
+
height.should == 100
|
177
|
+
end
|
178
|
+
it "should handle nil width" do
|
179
|
+
image_width_limit = 100
|
180
|
+
existing_height = 200
|
181
|
+
existing_width = nil
|
182
|
+
height = @parser.image_height(existing_height, existing_width, image_width_limit)
|
183
|
+
height.should == 200
|
184
|
+
end
|
171
185
|
end
|
172
186
|
|
173
187
|
end
|
data/sumitup.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "sumitup"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Justin Ball"]
|
12
|
-
s.date = "2012-03-
|
12
|
+
s.date = "2012-03-21"
|
13
13
|
s.description = "Given an html document or fragment this gem will build a summary of the content."
|
14
14
|
s.email = "justinball@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sumitup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Justin Ball
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-03-
|
18
|
+
date: 2012-03-21 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
type: :runtime
|