exif 2.0.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33f58a4ce4cca70c469d9d6df0ec65a5ba2709ac
4
- data.tar.gz: 4cb22e01351311cc90cca4280e72030d4cefbddd
3
+ metadata.gz: e9c95ed5bae94cb0ba692cc6e2c8f78a24919fd0
4
+ data.tar.gz: 03eddb0662aefd46ef6d746e6df5e33a70d25df2
5
5
  SHA512:
6
- metadata.gz: 82bb019a423559815f06793736aef8fc6bea78f8cdff7e602ef555087f66cf436d240f5842caad8951e5a9b43eaba16bb2be8bcfd2b53fbb8337e77bbf9d0b77
7
- data.tar.gz: 826aa853744d59ec237eeca0c4fc7c57f60f596abf236110d82e4a6aabb6838dbc86e65913a3772d7e5a1121b049ddf5c2bba030aa3863c158ec42c42977769c
6
+ metadata.gz: 15be77ed432c2d18fa63b5cdccfeb0349967b8b87851061dd0c296bb4a773e2eedd8e16411896489ca7e70ef4be6df646ed06a70a933f040131985c3bc301492
7
+ data.tar.gz: e931603d06c4702e4bfc44bf74eb73b22ae4e2f88b4253c6a1402ec85fcb6f0513bd023a46fb499904e598a5297b6177f562105815a38ff0765c4fe1541fa00d
@@ -6,7 +6,7 @@
6
6
  #include <stdint.h>
7
7
  #include <time.h>
8
8
 
9
- extern VALUE rb_mExif, rb_eNotReadble, rb_eIFDNotFound;
9
+ extern VALUE rb_mExif, rb_eNotReadable, rb_eIFDNotFound;
10
10
  extern const char *exif_entry_to_ivar(ExifEntry *entry);
11
11
 
12
12
  VALUE rb_cExifData;
@@ -188,17 +188,13 @@ VALUE new (VALUE self, VALUE input) {
188
188
  ExifData *ed;
189
189
  VALUE read_data;
190
190
 
191
- switch (TYPE(input)) {
192
- case T_STRING:
191
+ if (TYPE(input) == T_STRING)
193
192
  read_data = input;
194
- break;
195
- case T_FILE:
193
+ else if (rb_respond_to(input, rb_intern("read")))
196
194
  read_data = rb_funcall(input, rb_intern("read"), 0);
197
- break;
198
- default:
195
+ else
199
196
  rb_raise(rb_eTypeError, "wrong argument type %s (expected String or IO)",
200
197
  rb_obj_classname(input));
201
- }
202
198
 
203
199
  ExifLoader *loader = exif_loader_new();
204
200
  exif_loader_write(loader, (unsigned char *)RSTRING_PTR(read_data),
@@ -206,7 +202,7 @@ VALUE new (VALUE self, VALUE input) {
206
202
  ed = exif_loader_get_data(loader);
207
203
  exif_loader_unref(loader);
208
204
  if (!ed)
209
- rb_raise(rb_eNotReadble, "File not readable or no EXIF data in file.");
205
+ rb_raise(rb_eNotReadable, "File not readable or no EXIF data in file.");
210
206
 
211
207
  VALUE rb_data = Data_Wrap_Struct(self, NULL, exif_data_free, ed);
212
208
  rb_iv_set(rb_data, "@ifds", rb_hash_new());
@@ -1,16 +1,25 @@
1
1
  #include "data.h"
2
2
  #include "ruby.h"
3
3
 
4
- VALUE rb_mExif, rb_eError, rb_eNotReadble, rb_eIFDNotFound, rb_eUnknownDataType;
4
+ VALUE rb_mExif, rb_eError, rb_eNotReadable, rb_eIFDNotFound, rb_eUnknownDataType;
5
+
6
+ VALUE rb_exif_const_missing(VALUE klass, VALUE name) {
7
+ const char not_readble[] = "NotReadble";
8
+ if(strcmp(rb_id2name(SYM2ID(name)), not_readble) == 0) {
9
+ rb_warn("constant NotReadble is deprecated and will be removed in the future, use NotReadable instead.");
10
+ return rb_eNotReadable;
11
+ }
12
+ return rb_call_super(1, &name);
13
+ }
5
14
 
6
15
  void Init_exif(void) {
7
16
  rb_mExif = rb_define_module("Exif");
8
17
 
9
18
  rb_eError = rb_define_class_under(rb_mExif, "Error", rb_eStandardError);
10
- rb_eNotReadble = rb_define_class_under(rb_mExif, "NotReadble", rb_eError);
19
+ rb_eNotReadable = rb_define_class_under(rb_mExif, "NotReadable", rb_eError);
11
20
  rb_eIFDNotFound = rb_define_class_under(rb_mExif, "IFDNotFound", rb_eError);
12
21
  rb_eUnknownDataType =
13
22
  rb_define_class_under(rb_mExif, "UnknownDataType", rb_eError);
14
-
23
+ rb_define_singleton_method(rb_mExif, "const_missing", rb_exif_const_missing, 1);
15
24
  init_data();
16
25
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Exif
4
- VERSION = '2.0.1'
4
+ VERSION = '2.1.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exif
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jian Weihang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-02 00:00:00.000000000 Z
11
+ date: 2017-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  requirements: []
102
102
  rubyforge_project:
103
- rubygems_version: 2.6.12
103
+ rubygems_version: 2.6.14
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: Ruby EXIF reader written in C extension.