class_interface 0.1.0 → 0.1.1

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
- SHA256:
3
- metadata.gz: 9e465ca44514991917f4a749a1dca839aa52ca7ce0e8c2d00c5d8f0ba319e402
4
- data.tar.gz: a53c602ca939703b9f2ecff58d34176d6b9b101ab8cfd587a3e071086d57e35a
2
+ SHA1:
3
+ metadata.gz: d673f3122127a6d0be966062687001aef18a37c4
4
+ data.tar.gz: 5525615214e308b78291efcfc315fe1345ff5de2
5
5
  SHA512:
6
- metadata.gz: 7519f9f2f4959c21aa41becf47b68bb5c4a52d95fd9959968d60432c64a4d3108cf63f36561d50ffa5c8b95fafd1cd5c5055c82faa91dfa69731b95cbda80c21
7
- data.tar.gz: b9a57035bcf5f05fa76bc064daa4a5b87b147c3575b16c62a41453448a2369317374d42a847438fb3472c29f51bc889bce4267b8edda6d1fb3b79616c9cf62ba
6
+ metadata.gz: 9115e9849dabdfe64d2a8ad482fff685a62aa74e5c29278524819487c61ef2f29f32d2b10f13c1050701c4ffc7d0306600e3b0c0e368f21c62179faf02a42ea3
7
+ data.tar.gz: ae8db4d6bf1140e46594f78de02969c4d2a895764d34341f2641aa255d901ebb03313b93f10521bdb94b93ca03ca6c5538baf4c867bf14017b981f3cac3a468b
@@ -72,14 +72,18 @@ def implements(interface_constant)
72
72
  invalid_const_definitions += [const_name] unless if_const_class_type.class == Class
73
73
  next if if_const_class_type.to_s == 'NilClass'
74
74
  impl_const_value_type = Object.const_get("%s::%s" % [implementation_class, const_name]).class
75
+ ruby_version_lt_24 = (1.class.to_s == 'Fixnum')
76
+ ruby_version_gte_24 = (1.class.to_s == 'Integer')
75
77
  # Ruby < 2.4
76
- if defined?(Bignum) && if_const_class_type == Numeric && [Fixnum, Float, Bignum].include?(impl_const_value_type)
78
+ if ruby_version_lt_24 && if_const_class_type.to_s == 'Numeric' && %w[Fixnum Float Bignum].include?(impl_const_value_type.to_s)
77
79
  # we are fine, specific case for numbers
78
80
  # Ruby => 2.4
79
- elsif defined?(Integer) && if_const_class_type == Numeric && [Integer, Float].include?(impl_const_value_type)
81
+ elsif ruby_version_gte_24 && if_const_class_type.to_s == 'Numeric' && %w[Integer Float].include?(impl_const_value_type.to_s)
80
82
  # we are fine, specific case for numbers
81
- elsif defined?(Bignum) && ((if_const_class_type == Bignum && impl_const_value_type == Integer) ||
82
- (if_const_class_type == Fixnum && impl_const_value_type == Integer))
83
+ elsif ruby_version_lt_24 && ((if_const_class_type.to_s == 'Bignum' && impl_const_value_type.to_s == 'Integer') ||
84
+ (if_const_class_type.to_s == 'Fixnum' && impl_const_value_type.to_s == 'Integer') ||
85
+ (if_const_class_type.to_s == 'Integer' && impl_const_value_type.to_s == 'Fixnum') ||
86
+ (if_const_class_type.to_s == 'Integer' && impl_const_value_type.to_s == 'Bignum'))
83
87
  # Ruby 2.4 unifies Fixnum and Bignum into Integer
84
88
  elsif if_const_class_type != impl_const_value_type
85
89
  raise ClassInterface::ImplementationConstantTypeError, "Value type of constant '#{implementation_class}::#{const_name}' does not match interface '#{if_const_string}'. (#{impl_const_value_type} given, #{if_const_class_type} expected)"
@@ -1,3 +1,3 @@
1
1
  module ClassInterface
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: class_interface
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthäus Beyrle
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-14 00:00:00.000000000 Z
11
+ date: 2019-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  requirements: []
100
100
  rubyforge_project:
101
- rubygems_version: 2.7.6
101
+ rubygems_version: 2.5.2
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: Extends Ruby to support class interfaces