cow_proxy 0.1.2 → 0.1.3

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: d055ad28e6ab0d7c88bb1543ab122b1b9dd310ba
4
- data.tar.gz: 18b291113a0cd6b3b9662b4640e7087bd126297a
3
+ metadata.gz: 5a91cb4a013946161da6887f33dae43b6a6a5882
4
+ data.tar.gz: 0d86a0387ad7b39aeee5cfa0479827c3b655e7ae
5
5
  SHA512:
6
- metadata.gz: 607ea8e8a4a7d0bf713c65aeb55993e778f0fab06ebe9050de0a98ed7bd3e46c5c3c70cbe6388a1d03579baf45d756677954a6672a3b90ffaf95a2bf5bf280d8
7
- data.tar.gz: 7a167b8d6f5df69eea9579e5ba161a0e780c1338411fb43ee3197dc9a98ae298289d26d6d7cfb64945f75c8d7449d82659ae4066fb459b47d53f78f1982fdc49
6
+ metadata.gz: 6b418e1cfb972bffd3403e1b00b52eea84f5b53d8d5c6c165744dbb1e4b5f02037b9b8586b4e33bf6abef87bcc3a802e8db970d1ffeed1bc47da1b0346dc6277
7
+ data.tar.gz: 59b162b0c3f7939c27fc1ce6e828b3b9adf9a0892bdff552a60dff1674afa9488d9ecd7404a8e1932a07e6dde16e4e4da7d29ac4a7f930376f6941dce1174a2e
@@ -41,7 +41,7 @@ module CowProxy
41
41
  #
42
42
  # @return proxy_klass
43
43
  def register_proxy(klass, proxy_klass)
44
- debug { "register proxy for #{klass} with #{proxy_klass} < #{proxy_klass.superclass}" } unless @@wrapper_classes[klass]
44
+ debug { "register proxy for #{klass} with #{proxy_klass}#{" < #{proxy_klass.superclass}" if proxy_klass}" } unless @@wrapper_classes[klass]
45
45
  @@wrapper_classes[klass] ||= proxy_klass
46
46
  end
47
47
 
@@ -121,6 +121,12 @@ module CowProxy
121
121
  end
122
122
  end
123
123
 
124
+ if defined? Fixnum
125
+ CowProxy.register_proxy Fixnum, nil
126
+ end
127
+ if defined? Bignum
128
+ CowProxy.register_proxy Bignum, nil
129
+ end
124
130
  require 'cow_proxy/base.rb'
125
131
  require 'cow_proxy/indexable.rb'
126
132
  require 'cow_proxy/array.rb'
@@ -84,8 +84,9 @@ module CowProxy
84
84
  def __wrap__(value, inst_var = nil)
85
85
  if value.frozen?
86
86
  CowProxy.debug { "wrap #{value.class.name} with parent #{__getobj__.class.name}" }
87
- wrap_value = CowProxy.wrapper_class(value).new(value, self, inst_var)
88
- _instance_variable_set(inst_var, wrap_value) if inst_var
87
+ wrap_klass = CowProxy.wrapper_class(value)
88
+ wrap_value = wrap_klass.new(value, self, inst_var) if wrap_klass
89
+ _instance_variable_set(inst_var, wrap_value) if inst_var && wrap_value
89
90
  wrap_value
90
91
  end
91
92
  end
@@ -100,6 +101,7 @@ module CowProxy
100
101
  def __wrapped_method__(inst_var, cow, method, *args, &block)
101
102
  __wrapped_value__(inst_var, method, *args, &block)
102
103
  rescue => e
104
+ CowProxy.debug { "error #{e.message} on #{__getobj__.class.name} (#{__getobj__.object_id}) #{method} #{args.inspect unless args.empty?} with#{'out' unless cow} cow" }
103
105
  raise unless cow && e.message =~ /^can't modify frozen/
104
106
  CowProxy.debug { "copy on write to run #{method} #{args.inspect unless args.empty?} (#{e.message})" }
105
107
  __copy_on_write__
@@ -2,7 +2,7 @@ module CowProxy
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 2
5
+ PATCH = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cow_proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Cambra