cow_proxy 0.1.3 → 0.1.4

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: 5a91cb4a013946161da6887f33dae43b6a6a5882
4
- data.tar.gz: 0d86a0387ad7b39aeee5cfa0479827c3b655e7ae
3
+ metadata.gz: 14efdb18ea2cebbd36eeff0bd8806527863ddc0d
4
+ data.tar.gz: a5e3b93b639672be82f37f0990d9bce4d477122d
5
5
  SHA512:
6
- metadata.gz: 6b418e1cfb972bffd3403e1b00b52eea84f5b53d8d5c6c165744dbb1e4b5f02037b9b8586b4e33bf6abef87bcc3a802e8db970d1ffeed1bc47da1b0346dc6277
7
- data.tar.gz: 59b162b0c3f7939c27fc1ce6e828b3b9adf9a0892bdff552a60dff1674afa9488d9ecd7404a8e1932a07e6dde16e4e4da7d29ac4a7f930376f6941dce1174a2e
6
+ metadata.gz: edfd0a67bbadf39a3be94a82c30513d9724f06bcc9ac8222f01fbbcd2688498d4572d18fb8364697ed3d5f23bd219e12bf846d3611f7a59eb831a11ff95e44b9
7
+ data.tar.gz: 9fcecde8d412d062cf0da1aa0592bba8204da2d1bbaac7a798f4e40b3861912b146abad31cc8d07511dbe45f6e2833bc5b048bcf542bf4f66b0f0869b2c8f8e8
@@ -14,7 +14,7 @@
14
14
  module CowProxy
15
15
  class << self
16
16
  # @!visibility private
17
- @@wrapper_classes = {Integer: nil, Float: nil, Symbol: nil, TrueClass: nil, FalseClass: nil, NilClass: nil}
17
+ @@wrapper_classes = {}
18
18
 
19
19
  # Create new proxy class for klass, with copy on write enabled.
20
20
  #
@@ -121,12 +121,17 @@ module CowProxy
121
121
  end
122
122
  end
123
123
 
124
+ # no proxy klass for immutable classes
125
+ [Integer, Float, Symbol, TrueClass, FalseClass, NilClass].each do |klass|
126
+ CowProxy.register_proxy klass, nil
127
+ end
124
128
  if defined? Fixnum
125
129
  CowProxy.register_proxy Fixnum, nil
126
130
  end
127
131
  if defined? Bignum
128
132
  CowProxy.register_proxy Bignum, nil
129
133
  end
134
+
130
135
  require 'cow_proxy/base.rb'
131
136
  require 'cow_proxy/indexable.rb'
132
137
  require 'cow_proxy/array.rb'
@@ -1,6 +1,14 @@
1
1
  module CowProxy
2
2
  class Array < WrapClass(::Array)
3
3
  include Indexable
4
+
5
+ # Used for concatenating into another Array
6
+ # needs to return unwrapped Array
7
+ #
8
+ # @return [Array] wrapped object
9
+ def to_ary
10
+ __getobj__
11
+ end
4
12
  end
5
13
 
6
14
  end
@@ -1,6 +1,14 @@
1
1
  module CowProxy
2
2
  class Hash < WrapClass(::Hash)
3
3
  include Indexable
4
+
5
+ # Used for merging into another Hash
6
+ # needs to return unwrapped Hash
7
+ #
8
+ # @return [Hash] wrapped object
9
+ def to_hash
10
+ __getobj__
11
+ end
4
12
  end
5
13
 
6
14
  end
@@ -2,7 +2,7 @@ module CowProxy
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 3
5
+ PATCH = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cow_proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Cambra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-23 00:00:00.000000000 Z
11
+ date: 2017-03-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Make a COW proxy for a frozen object (or deep frozen), it will delegate
14
14
  every read method to proxied object, wrap value in COW proxy if frozen. Trying to
@@ -49,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
49
  version: '0'
50
50
  requirements: []
51
51
  rubyforge_project:
52
- rubygems_version: 2.5.1
52
+ rubygems_version: 2.6.10
53
53
  signing_key:
54
54
  specification_version: 4
55
55
  summary: Copy-on-write proxy class, to use with frozen objects