image_info 1.0.0 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 41902fde9c8f38c8f056e8c7713d9c674762143d
4
- data.tar.gz: 29b70c445221d0cbbbdff692b4662089d7c5e6f2
3
+ metadata.gz: 335b5d988c8fec52bf9d34596062dd56ff9d4db2
4
+ data.tar.gz: 4547675b414cd13d918d5abe0349b3db7516f5cb
5
5
  SHA512:
6
- metadata.gz: ed3ddfc150811e6a644e897638b821a32f33e4c41d127a9bf147fccae82fb761130c7c8b04d8aa6eecd727224504fbcbcc010bb9d24c330529441d73f880abb7
7
- data.tar.gz: cdb46ae585dffe7cf6f635583655c09888bf5b41c315ac13ed963a0ab859f1adb1e6f529c222e7b5b8ca293fb2b141ce1ce2de967a5b44b79ddb85514e92dd46
6
+ metadata.gz: e8b7a26d43a838cb5291837e26a96c7c1bc7748c6ec86dd64a04ca00ee0f93c28c9856ea057b6e8c0ab5d8fd4b85da4c74d483b9d68425f4732df69b230e5f1a
7
+ data.tar.gz: a4385f974bffe74fd345ca38f0dd39536dde0a21db75d5426d52ecb0040246b68d03fb4f606a54aed20615cb4d2b4ed06df8f2a59a2680a83b6898065b8b6212
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ * 1.1.0
2
+
3
+ - Introduces `width` and `height` method. Fixes [https://github.com/gottfrois/image_info/issues/2](https://github.com/gottfrois/image_info/issues/2)
4
+
5
+ * 1.0.0
6
+
7
+ - First release
data/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![Code Climate](https://codeclimate.com/github/gottfrois/image_info/badges/gpa.svg)](https://codeclimate.com/github/gottfrois/image_info)
4
4
  [![Build Status](https://travis-ci.org/gottfrois/image_info.svg)](https://travis-ci.org/gottfrois/image_info)
5
5
  [![Dependency Status](https://gemnasium.com/gottfrois/image_info.svg)](https://gemnasium.com/gottfrois/image_info)
6
+ [![Gem Version](https://badge.fury.io/rb/image_info.svg)](http://badge.fury.io/rb/image_info)
6
7
 
7
8
  ImageInfo finds the size and type of a single or multiple images from the web by fetching as little as needed in batches.
8
9
 
@@ -34,6 +35,10 @@ For a single image:
34
35
 
35
36
  ```ruby
36
37
  image = ImageInfo.from('http://foo.com/foo.png').first
38
+ image.width
39
+ => 256
40
+ image.height
41
+ => 256
37
42
  image.size
38
43
  => [256, 256]
39
44
  image.type
@@ -4,11 +4,14 @@ module ImageInfo
4
4
  class Image
5
5
 
6
6
  attr_reader :uri
7
- attr_accessor :size, :type
7
+ attr_accessor :width, :height, :type
8
8
 
9
9
  def initialize(uri)
10
- @uri = ::URI.parse(uri.to_s)
11
- @size = []
10
+ @uri = ::URI.parse(uri.to_s)
11
+ end
12
+
13
+ def size
14
+ [width, height].compact
12
15
  end
13
16
 
14
17
  def valid?
@@ -6,8 +6,8 @@ module ImageInfo
6
6
  attr_reader :image, :bytes, :parser
7
7
 
8
8
  def initialize(image, data)
9
- @image = image
10
- @bytes = data.bytes
9
+ @image = image
10
+ @bytes = data.bytes
11
11
  @parser = ::ImageSize.new(data)
12
12
  end
13
13
 
@@ -19,7 +19,8 @@ module ImageInfo
19
19
  private
20
20
 
21
21
  def set_image_size
22
- image.size = [parser.width, parser.height]
22
+ image.width = parser.width
23
+ image.height = parser.height
23
24
  end
24
25
 
25
26
  def set_image_type
@@ -1,3 +1,3 @@
1
1
  module ImageInfo
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_info
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre-Louis Gottfrois
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-03 00:00:00.000000000 Z
11
+ date: 2015-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -105,6 +105,7 @@ files:
105
105
  - .gitignore
106
106
  - .rspec
107
107
  - .travis.yml
108
+ - CHANGELOG.md
108
109
  - Gemfile
109
110
  - LICENSE.txt
110
111
  - README.md