mores 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mores.rb +1 -0
- data/lib/mores/immutable_struct.rb +24 -0
- data/lib/mores/immutable_struct/flyweight.rb +5 -0
- data/lib/mores/immutable_struct/strict.rb +8 -0
- data/lib/mores/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a05f6aa6035150e1284633d30bbb3a0da3a96b5
|
4
|
+
data.tar.gz: f04a463e4896ee94728c23f6441459bd170243a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3203d0ab814d35b943ebabeb7c76daac713c60f2fbf73420490655651a9bff54f561c9bcdb627d013996112aef99bd5635ecd963b709eecbe9f7ae2408add332
|
7
|
+
data.tar.gz: 947196ce46eabf9689decec1861f17fa54da0898b07fcec35d29cfa0bf302e2d0655c416e4634d337ac97202f5bc2515d7f7fa8d6f199ad75ddc263a22013893
|
data/lib/mores.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
module Mores
|
2
|
+
|
3
|
+
class ImmutableStruct < ::Struct
|
4
|
+
require_relative 'immutable_struct/flyweight'
|
5
|
+
require_relative 'immutable_struct/strict'
|
6
|
+
|
7
|
+
DEFAULT_OPTIONS = { flyweight: true }.freeze
|
8
|
+
|
9
|
+
undef_method :[]=
|
10
|
+
|
11
|
+
def self.new(*args, **options, &block)
|
12
|
+
options = DEFAULT_OPTIONS.merge options
|
13
|
+
|
14
|
+
super(*args, &block).tap do |klass|
|
15
|
+
klass.instance_eval do
|
16
|
+
members.each { |x| remove_method "#{x}=" }
|
17
|
+
include Flyweight if options[:flyweight]
|
18
|
+
include Strict if options[:strict]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/lib/mores/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mores
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Petter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -78,6 +78,9 @@ files:
|
|
78
78
|
- README.md
|
79
79
|
- lib/mores.rb
|
80
80
|
- lib/mores/block_initialize.rb
|
81
|
+
- lib/mores/immutable_struct.rb
|
82
|
+
- lib/mores/immutable_struct/flyweight.rb
|
83
|
+
- lib/mores/immutable_struct/strict.rb
|
81
84
|
- lib/mores/linked_list.rb
|
82
85
|
- lib/mores/succession.rb
|
83
86
|
- lib/mores/version.rb
|