striuct 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +8 -3
- data/Gemfile +1 -1
- data/History.old(~0.3.n).rdoc +1 -2
- data/README.md +7 -13
- data/Rakefile +1 -2
- data/benchmark/basics.rb +1 -1
- data/example/README.rb +3 -3
- data/example/example1.rb +4 -4
- data/example/example2.rb +1 -1
- data/example/see_trace.rb +1 -1
- data/lib/striuct/classmethods/adjustment.rb +1 -1
- data/lib/striuct/classmethods/attributes.rb +1 -1
- data/lib/striuct/classmethods/conflict_management.rb +1 -1
- data/lib/striuct/classmethods/constructor.rb +1 -1
- data/lib/striuct/classmethods/copy.rb +1 -1
- data/lib/striuct/classmethods/default.rb +1 -1
- data/lib/striuct/classmethods/enum.rb +1 -1
- data/lib/striuct/classmethods/fix.rb +1 -1
- data/lib/striuct/classmethods/hashdeepdupulicatable.rb +1 -1
- data/lib/striuct/classmethods/inner.rb +9 -1
- data/lib/striuct/classmethods/length.rb +1 -1
- data/lib/striuct/classmethods/macro.rb +9 -9
- data/lib/striuct/classmethods/names.rb +1 -1
- data/lib/striuct/classmethods/predicate.rb +1 -1
- data/lib/striuct/classmethods/requirements.rb +1 -1
- data/lib/striuct/classmethods/validation.rb +1 -1
- data/lib/striuct/instancemethods/README.md +1 -1
- data/lib/striuct/instancemethods/assign.rb +8 -10
- data/lib/striuct/instancemethods/cast.rb +1 -1
- data/lib/striuct/instancemethods/compare.rb +1 -1
- data/lib/striuct/instancemethods/default.rb +1 -1
- data/lib/striuct/instancemethods/delegate_class_methods.rb +1 -1
- data/lib/striuct/instancemethods/enum.rb +1 -1
- data/lib/striuct/instancemethods/getter.rb +1 -1
- data/lib/striuct/instancemethods/hashy.rb +5 -5
- data/lib/striuct/instancemethods/keyvalidatable.rb +1 -1
- data/lib/striuct/instancemethods/lock.rb +9 -13
- data/lib/striuct/instancemethods/object.rb +9 -1
- data/lib/striuct/instancemethods/requirements.rb +1 -1
- data/lib/striuct/instancemethods/setter.rb +3 -3
- data/lib/striuct/instancemethods/to_s.rb +1 -1
- data/lib/striuct/instancemethods/validation.rb +1 -1
- data/lib/striuct/instancemethods/values.rb +1 -1
- data/lib/striuct/requirements.rb +1 -1
- data/lib/striuct/singleton_class.rb +1 -1
- data/lib/striuct/structs.rb +1 -1
- data/lib/striuct.rb +1 -1
- data/striuct.gemspec +22 -15
- data/test/test_subc-f-predicate.rb +8 -8
- data/test/test_subc-i-assign.rb +4 -0
- data/test/test_subc-i-validation_inference.rb +1 -1
- metadata +77 -26
data/.travis.yml
CHANGED
@@ -1,15 +1,20 @@
|
|
1
1
|
language: ruby
|
2
|
+
|
2
3
|
rvm:
|
3
4
|
- ruby-head
|
5
|
+
- 2.0.0
|
4
6
|
- 1.9.3
|
5
7
|
- 1.9.2
|
6
|
-
- rbx-19mode
|
8
|
+
- rbx-nightly-19mode
|
7
9
|
- jruby-head
|
10
|
+
- jruby-19mode
|
8
11
|
|
9
12
|
matrix:
|
10
13
|
allow_failures:
|
11
|
-
- rvm:
|
14
|
+
- rvm: ruby-head
|
15
|
+
- rvm: rbx-nightly-19mode
|
12
16
|
- rvm: jruby-head
|
17
|
+
- rvm: jruby-19mode
|
13
18
|
|
14
19
|
before_install:
|
15
|
-
- gem install bundler
|
20
|
+
- gem install bundler
|
data/Gemfile
CHANGED
data/History.old(~0.3.n).rdoc
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
striuct
|
2
2
|
=======
|
3
3
|
|
4
|
+
[![Build Status](https://secure.travis-ci.org/kachick/striuct.png)](http://travis-ci.org/kachick/striuct)
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/striuct.png)](http://badge.fury.io/rb/striuct)
|
6
|
+
|
4
7
|
Description
|
5
8
|
-----------
|
6
9
|
|
@@ -74,9 +77,9 @@ foo = Foo.new
|
|
74
77
|
|
75
78
|
# nil <-> unaasigned
|
76
79
|
foo.foo #=> nil
|
77
|
-
foo.
|
80
|
+
foo.assigned?(:foo) #=> false
|
78
81
|
foo.foo = nil
|
79
|
-
foo.
|
82
|
+
foo.assigned?(:foo) #=> true
|
80
83
|
|
81
84
|
# Lock to a member
|
82
85
|
foo.lock(:foo)
|
@@ -100,22 +103,14 @@ Requirements
|
|
100
103
|
-------------
|
101
104
|
|
102
105
|
* Ruby - [1.9.2 or later](http://travis-ci.org/#!/kachick/striuct)
|
103
|
-
* [validation](https://github.com/kachick/validation) - 0.0.3
|
104
|
-
* [optionalargument](https://github.com/kachick/optionalargument) - 0.0.3
|
105
|
-
* [keyvalidatable](https://github.com/kachick/keyvalidatable) - 0.0.5
|
106
106
|
|
107
107
|
Install
|
108
108
|
-------
|
109
109
|
|
110
110
|
```bash
|
111
|
-
|
111
|
+
gem install striuct
|
112
112
|
```
|
113
113
|
|
114
|
-
Build Status
|
115
|
-
-------------
|
116
|
-
|
117
|
-
[![Build Status](https://secure.travis-ci.org/kachick/striuct.png)](http://travis-ci.org/kachick/striuct)
|
118
|
-
|
119
114
|
Link
|
120
115
|
----
|
121
116
|
|
@@ -131,5 +126,4 @@ License
|
|
131
126
|
|
132
127
|
The MIT X11 License
|
133
128
|
Copyright (c) 2011 Kenichi Kamiya
|
134
|
-
See MIT-LICENSE for further details.
|
135
|
-
|
129
|
+
See MIT-LICENSE for further details.
|
data/Rakefile
CHANGED
data/benchmark/basics.rb
CHANGED
data/example/README.rb
CHANGED
@@ -34,13 +34,13 @@ end
|
|
34
34
|
|
35
35
|
foo = Foo.new
|
36
36
|
p foo.foo #=> nil
|
37
|
-
p foo.
|
37
|
+
p foo.assigned?(:foo) #=> false
|
38
38
|
foo.foo = nil
|
39
|
-
p foo.
|
39
|
+
p foo.assigned?(:foo) #=> true
|
40
40
|
foo.lock(:foo)
|
41
41
|
#~ foo.foo = nil #=> error
|
42
42
|
foo.bar = 1.2
|
43
43
|
#~ foo.bar = 1 #=> error
|
44
44
|
|
45
45
|
foo.with_adjuster = '5'
|
46
|
-
p foo.with_adjuster
|
46
|
+
p foo.with_adjuster
|
data/example/example1.rb
CHANGED
@@ -77,7 +77,7 @@ end
|
|
77
77
|
|
78
78
|
# through "inference", and check under first passed object class
|
79
79
|
class FlexibleContainer < Striuct.new
|
80
|
-
member :anything,
|
80
|
+
member :anything, BasicObject, inference: true
|
81
81
|
member :number, Numeric, inference: true
|
82
82
|
end
|
83
83
|
|
@@ -184,9 +184,9 @@ user3
|
|
184
184
|
debug user3
|
185
185
|
|
186
186
|
# Standard Struct always define "nil is default". ...realy?
|
187
|
-
debug user3.
|
187
|
+
debug user3.assigned?(:name)
|
188
188
|
user3.name = nil
|
189
|
-
debug user3.
|
189
|
+
debug user3.assigned?(:name)
|
190
190
|
|
191
191
|
# Alias
|
192
192
|
|
@@ -232,4 +232,4 @@ p a
|
|
232
232
|
|
233
233
|
p MyC.new.to_struct
|
234
234
|
myc = Striuct.new :a, :b
|
235
|
-
p myc.new.to_struct
|
235
|
+
p myc.new.to_struct
|
data/example/example2.rb
CHANGED
data/example/see_trace.rb
CHANGED
@@ -48,7 +48,7 @@ class Striuct; module ClassMethods
|
|
48
48
|
new.tap {|instance|
|
49
49
|
yield instance
|
50
50
|
|
51
|
-
yets = autonyms.select{|autonym|! instance.
|
51
|
+
yets = autonyms.select{|autonym|! instance.assigned?(autonym)}
|
52
52
|
unless yets.empty?
|
53
53
|
raise "not assigned members are, yet '#{yets.inspect} in #{self}'"
|
54
54
|
end
|
@@ -23,6 +23,14 @@ class Striuct; module ClassMethods
|
|
23
23
|
@attributes.fetch autonym
|
24
24
|
end
|
25
25
|
|
26
|
+
def _check_frozen
|
27
|
+
raise "can't modify frozen Class" if frozen?
|
28
|
+
end
|
29
|
+
|
30
|
+
def _check_closed
|
31
|
+
raise "can't modify closed member attributes in #{self}" if closed?
|
32
|
+
end
|
33
|
+
|
26
34
|
def _def_getter(autonym)
|
27
35
|
define_method autonym do
|
28
36
|
_get autonym
|
@@ -58,4 +66,4 @@ class Striuct; module ClassMethods
|
|
58
66
|
|
59
67
|
# @endgroup
|
60
68
|
|
61
|
-
end; end
|
69
|
+
end; end
|
@@ -28,8 +28,8 @@ class Striuct; module ClassMethods
|
|
28
28
|
# @option options [Boolean] :setter_validation
|
29
29
|
# @return [nil]
|
30
30
|
def add_member(autonym, condition=ANYTHING, options={}, &adjuster)
|
31
|
-
|
32
|
-
|
31
|
+
_check_frozen
|
32
|
+
_check_closed
|
33
33
|
|
34
34
|
options = ADD_MEMBER_OptArg.parse options
|
35
35
|
autonym = autonym.to_sym # First difinition for an autonym
|
@@ -64,8 +64,8 @@ class Striuct; module ClassMethods
|
|
64
64
|
# @param [Symbol, String, #to_sym] autonyms
|
65
65
|
# @return [nil]
|
66
66
|
def add_members(autonym, *autonyms)
|
67
|
-
|
68
|
-
|
67
|
+
_check_frozen
|
68
|
+
_check_closed
|
69
69
|
|
70
70
|
[autonym, *autonyms].each {|_autonym|add_member _autonym}
|
71
71
|
nil
|
@@ -75,8 +75,8 @@ class Striuct; module ClassMethods
|
|
75
75
|
# @param [Symbol, String, #to_sym] autonym
|
76
76
|
# @return [nil]
|
77
77
|
def alias_member(aliased, autonym)
|
78
|
-
|
79
|
-
|
78
|
+
_check_frozen
|
79
|
+
_check_closed
|
80
80
|
autonym = autonym_for_member autonym
|
81
81
|
aliased = aliased.to_sym
|
82
82
|
raise ArgumentError, %Q!already exist name "#{aliased}"! if member? aliased
|
@@ -91,8 +91,8 @@ class Striuct; module ClassMethods
|
|
91
91
|
# @param [Symbol, String, #to_sym] name
|
92
92
|
# @return [nil]
|
93
93
|
def set_default_value(name, value=nil, &block)
|
94
|
-
|
95
|
-
|
94
|
+
_check_frozen
|
95
|
+
_check_closed
|
96
96
|
autonym = autonym_for_member name
|
97
97
|
raise "already settled default value for #{name}" if with_default? autonym
|
98
98
|
|
@@ -113,4 +113,4 @@ class Striuct; module ClassMethods
|
|
113
113
|
|
114
114
|
# @endgroup
|
115
115
|
|
116
|
-
end; end
|
116
|
+
end; end
|
@@ -3,21 +3,19 @@ class Striuct; module InstanceMethods
|
|
3
3
|
# @group Assign / Unassign
|
4
4
|
|
5
5
|
# @param [Symbol, String, #to_sym, Integer, #to_int] key - name / index
|
6
|
-
def
|
7
|
-
|
8
|
-
|
9
|
-
@db.has_key? autonym
|
6
|
+
def assigned?(key)
|
7
|
+
@db.has_key? autonym_for_key(key)
|
10
8
|
end
|
9
|
+
|
10
|
+
alias_method :assign?, :assigned?
|
11
11
|
|
12
12
|
# @param [Symbol, String, #to_sym, Integer, #to_int] key - name / index
|
13
13
|
# @return value / nil - value assigned under the key
|
14
14
|
def unassign(key)
|
15
|
-
|
15
|
+
_check_frozen
|
16
|
+
_check_locked key
|
16
17
|
|
17
|
-
|
18
|
-
raise "can't modify locked member #{autonym}" if locked? autonym
|
19
|
-
|
20
|
-
@db.delete autonym
|
18
|
+
@db.delete autonym_for_key(key)
|
21
19
|
end
|
22
20
|
|
23
21
|
alias_method :delete_at, :unassign
|
@@ -29,4 +27,4 @@ class Striuct; module InstanceMethods
|
|
29
27
|
|
30
28
|
# @endgroup
|
31
29
|
|
32
|
-
end; end
|
30
|
+
end; end
|
@@ -16,7 +16,7 @@ class Striuct; module InstanceMethods
|
|
16
16
|
# @yieldreturn [self]
|
17
17
|
# @yieldreturn [nil]
|
18
18
|
def select!
|
19
|
-
|
19
|
+
_check_frozen
|
20
20
|
return to_enum(__callee__) unless block_given?
|
21
21
|
|
22
22
|
modified = false
|
@@ -35,7 +35,7 @@ class Striuct; module InstanceMethods
|
|
35
35
|
# @yieldparam [Symbol] autonym
|
36
36
|
# @return [Enumerator]
|
37
37
|
def keep_if(&block)
|
38
|
-
|
38
|
+
_check_frozen
|
39
39
|
return to_enum(__callee__) unless block_given?
|
40
40
|
|
41
41
|
select!(&block)
|
@@ -48,7 +48,7 @@ class Striuct; module InstanceMethods
|
|
48
48
|
# @yieldparam [Symbol] autonym
|
49
49
|
# @return [Enumerator]
|
50
50
|
def reject!
|
51
|
-
|
51
|
+
_check_frozen
|
52
52
|
return to_enum(__callee__) unless block_given?
|
53
53
|
|
54
54
|
modified = false
|
@@ -67,7 +67,7 @@ class Striuct; module InstanceMethods
|
|
67
67
|
# @yieldparam [Symbol] autonym
|
68
68
|
# @return [Enumerator]
|
69
69
|
def delete_if(&block)
|
70
|
-
|
70
|
+
_check_frozen
|
71
71
|
return to_enum(__callee__) unless block_given?
|
72
72
|
|
73
73
|
reject!(&block)
|
@@ -115,4 +115,4 @@ class Striuct; module InstanceMethods
|
|
115
115
|
|
116
116
|
# @endgroup
|
117
117
|
|
118
|
-
end; end
|
118
|
+
end; end
|
@@ -5,16 +5,15 @@ class Striuct; module InstanceMethods
|
|
5
5
|
# @param [Symbol, String, #to_sym, Integer, #to_int] key - name / index
|
6
6
|
# @return [self]
|
7
7
|
def lock(key)
|
8
|
-
|
9
|
-
autonym = autonym_for_key key
|
8
|
+
_check_frozen
|
10
9
|
|
11
|
-
@locks[
|
10
|
+
@locks[autonym_for_key(key)] = true
|
12
11
|
self
|
13
12
|
end
|
14
13
|
|
15
14
|
# @return [self]
|
16
15
|
def lock_all
|
17
|
-
|
16
|
+
_check_frozen
|
18
17
|
|
19
18
|
each_autonym do |autonym|
|
20
19
|
@locks[autonym] = true
|
@@ -23,9 +22,7 @@ class Striuct; module InstanceMethods
|
|
23
22
|
|
24
23
|
# @param [Symbol, String, #to_sym, Integer, #to_int] key - name / index
|
25
24
|
def locked?(key)
|
26
|
-
|
27
|
-
|
28
|
-
@locks.has_key? autonym
|
25
|
+
@locks.has_key? autonym_for_key(key)
|
29
26
|
end
|
30
27
|
|
31
28
|
def all_locked?
|
@@ -37,16 +34,15 @@ class Striuct; module InstanceMethods
|
|
37
34
|
# @param [Symbol, String, #to_sym, Integer, #to_int] key - name / index
|
38
35
|
# @return [self]
|
39
36
|
def unlock(key)
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
@locks.delete autonym
|
37
|
+
_check_frozen
|
38
|
+
|
39
|
+
@locks.delete autonym_for_key(key)
|
44
40
|
self
|
45
41
|
end
|
46
42
|
|
47
43
|
# @return [self]
|
48
44
|
def unlock_all
|
49
|
-
|
45
|
+
_check_frozen
|
50
46
|
|
51
47
|
@locks.clear
|
52
48
|
self
|
@@ -54,4 +50,4 @@ class Striuct; module InstanceMethods
|
|
54
50
|
|
55
51
|
# @endgroup
|
56
52
|
|
57
|
-
end; end
|
53
|
+
end; end
|
@@ -21,6 +21,14 @@ class Striuct; module InstanceMethods
|
|
21
21
|
@db, @locks = @db.dup, {}
|
22
22
|
end
|
23
23
|
|
24
|
+
def _check_frozen
|
25
|
+
raise "can't modify frozen #{self.class}" if frozen?
|
26
|
+
end
|
27
|
+
|
28
|
+
def _check_locked(key)
|
29
|
+
raise "can't modify locked member `#{key}`" if locked? key
|
30
|
+
end
|
31
|
+
|
24
32
|
# @endgroup
|
25
33
|
|
26
|
-
end; end
|
34
|
+
end; end
|
@@ -23,8 +23,8 @@ class Striuct; module InstanceMethods
|
|
23
23
|
# @param [Symbol] autonym - MUST already converted to native autonym
|
24
24
|
# @return value
|
25
25
|
def _set(autonym, value)
|
26
|
-
|
27
|
-
|
26
|
+
_check_frozen
|
27
|
+
_check_locked autonym
|
28
28
|
|
29
29
|
if with_adjuster? autonym
|
30
30
|
begin
|
@@ -55,4 +55,4 @@ class Striuct; module InstanceMethods
|
|
55
55
|
|
56
56
|
# @endgroup
|
57
57
|
|
58
|
-
end; end
|
58
|
+
end; end
|
data/lib/striuct/requirements.rb
CHANGED
data/lib/striuct/structs.rb
CHANGED
data/lib/striuct.rb
CHANGED
data/striuct.gemspec
CHANGED
@@ -1,27 +1,34 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
|
-
|
3
|
-
|
4
|
-
gem.
|
5
|
-
|
2
|
+
# specific
|
3
|
+
|
4
|
+
gem.description = %q{Struct++ library
|
5
|
+
|
6
|
+
Validatable, Inheritable, Member Aliasing,
|
6
7
|
Conflict Management, Default Value, Divide nil with unassign,
|
7
8
|
Lock setter of each member, Hash flendly API, ... And more Struct++ features :)}
|
8
|
-
gem.homepage = 'https://github.com/kachick/striuct'
|
9
9
|
|
10
|
-
gem.
|
11
|
-
gem.
|
12
|
-
gem.
|
10
|
+
gem.summary = gem.description.dup
|
11
|
+
gem.homepage = 'http://kachick.github.com/striuct/'
|
12
|
+
gem.license = 'MIT'
|
13
13
|
gem.name = 'striuct'
|
14
|
-
gem.
|
15
|
-
gem.version = '0.4.2'
|
14
|
+
gem.version = '0.4.3'
|
16
15
|
|
17
16
|
gem.required_ruby_version = '>= 1.9.2'
|
18
17
|
|
19
|
-
gem.add_runtime_dependency 'validation', '~> 0.0.
|
18
|
+
gem.add_runtime_dependency 'validation', '~> 0.0.5'
|
20
19
|
gem.add_runtime_dependency 'optionalargument', '~> 0.0.3'
|
21
20
|
gem.add_runtime_dependency 'keyvalidatable', '~> 0.0.5'
|
22
21
|
|
23
|
-
gem.add_development_dependency 'yard', '
|
24
|
-
gem.add_development_dependency 'rake'
|
25
|
-
gem.add_development_dependency 'bundler'
|
26
|
-
end
|
22
|
+
gem.add_development_dependency 'yard', '>= 0.8.6.1', '< 2'
|
23
|
+
gem.add_development_dependency 'rake', '>= 10', '< 20'
|
24
|
+
gem.add_development_dependency 'bundler', '>= 1.3.5', '< 2'
|
27
25
|
|
26
|
+
# common
|
27
|
+
|
28
|
+
gem.authors = ['Kenichi Kamiya']
|
29
|
+
gem.email = ['kachick1+ruby@gmail.com']
|
30
|
+
gem.files = `git ls-files`.split($\)
|
31
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
32
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
33
|
+
gem.require_paths = ['lib']
|
34
|
+
end
|
@@ -145,10 +145,10 @@ class Test_Striuct_Subclass_Predicate_Default < Test::Unit::TestCase
|
|
145
145
|
|
146
146
|
class Subclass < Striuct
|
147
147
|
member :foo
|
148
|
-
member :val,
|
148
|
+
member :val, BasicObject, default: 'DEFAULT'
|
149
149
|
|
150
150
|
conflict_management :struct do
|
151
|
-
member :lazy,
|
151
|
+
member :lazy, BasicObject, default_proc: ->{}
|
152
152
|
end
|
153
153
|
|
154
154
|
alias_member :als_foo, :foo
|
@@ -261,7 +261,7 @@ class Test_Striuct_Subclass_Predicate_Condition < Test::Unit::TestCase
|
|
261
261
|
alias_member :als_no_with, :no_with
|
262
262
|
member :with, nil
|
263
263
|
alias_member :als_with, :with
|
264
|
-
member :with_any,
|
264
|
+
member :with_any, BasicObject
|
265
265
|
alias_member :als_with_any, :with_any
|
266
266
|
member :adj_with, nil do |_|; end
|
267
267
|
alias_member :als_adj_with, :adj_with
|
@@ -325,7 +325,7 @@ class Test_Striuct_Subclass_Predicate_InferenceValidation < Test::Unit::TestCase
|
|
325
325
|
alias_member :als_no_with, :no_with
|
326
326
|
member :with, nil, inference: true
|
327
327
|
alias_member :als_with, :with
|
328
|
-
member :with_any,
|
328
|
+
member :with_any, BasicObject, inference: true
|
329
329
|
alias_member :als_with_any, :with_any
|
330
330
|
member :adj_with, nil, inference: true do |_|; end
|
331
331
|
alias_member :als_adj_with, :adj_with
|
@@ -390,7 +390,7 @@ class Test_Striuct_Subclass_Predicate_HookTiming_Setter_Enable < Test::Unit::Tes
|
|
390
390
|
alias_member :als_no_with, :no_with
|
391
391
|
member :with, nil, setter_validation: true
|
392
392
|
alias_member :als_with, :with
|
393
|
-
member :with_any,
|
393
|
+
member :with_any, BasicObject, writer_validation: true
|
394
394
|
alias_member :als_with_any, :with_any
|
395
395
|
member :adj_with, nil, writer_validation: true do |_|; end
|
396
396
|
alias_member :als_adj_with, :adj_with
|
@@ -456,7 +456,7 @@ class Test_Striuct_Subclass_Predicate_HookTiming_Setter_Disable < Test::Unit::Te
|
|
456
456
|
member :with, nil, setter_validation: false
|
457
457
|
alias_member :als_with, :with
|
458
458
|
|
459
|
-
member :with_any,
|
459
|
+
member :with_any, BasicObject, writer_validation: false
|
460
460
|
alias_member :als_with_any, :with_any
|
461
461
|
|
462
462
|
member :adj_with, nil, writer_validation: false do |_|; end
|
@@ -522,7 +522,7 @@ class Test_Striuct_Subclass_Predicate_HookTiming_Getter_Enable < Test::Unit::Tes
|
|
522
522
|
alias_member :als_no_with, :no_with
|
523
523
|
member :with, nil, getter_validation: true
|
524
524
|
alias_member :als_with, :with
|
525
|
-
member :with_any,
|
525
|
+
member :with_any, BasicObject, reader_validation: true
|
526
526
|
alias_member :als_with_any, :with_any
|
527
527
|
member :adj_with, nil, reader_validation: true do |_|; end
|
528
528
|
alias_member :als_adj_with, :adj_with
|
@@ -588,7 +588,7 @@ class Test_Striuct_Subclass_Predicate_HookTiming_Getter_Disable < Test::Unit::Te
|
|
588
588
|
member :with, nil, getter_validation: false
|
589
589
|
alias_member :als_with, :with
|
590
590
|
|
591
|
-
member :with_any,
|
591
|
+
member :with_any, BasicObject, reader_validation: false
|
592
592
|
alias_member :als_with_any, :with_any
|
593
593
|
|
594
594
|
member :adj_with, nil, reader_validation: false do |_|; end
|
data/test/test_subc-i-assign.rb
CHANGED
@@ -10,12 +10,16 @@ class Test_Striuct_Subclass_Instance_Assign < Test::Unit::TestCase
|
|
10
10
|
define_method :"test_#{callee}" do
|
11
11
|
sth = Sth.new
|
12
12
|
assert_equal false, sth.assign?(:foo)
|
13
|
+
assert_equal false, sth.assigned?(:foo)
|
13
14
|
sth.foo = nil
|
14
15
|
assert_equal true, sth.assign?(:foo)
|
16
|
+
assert_equal true, sth.assigned?(:foo)
|
15
17
|
sth.public_send callee, :foo
|
16
18
|
assert_equal false, sth.assign?(:foo)
|
19
|
+
assert_equal false, sth.assigned?(:foo)
|
17
20
|
sth.foo = nil
|
18
21
|
assert_equal true, sth.assign?(:foo)
|
22
|
+
assert_equal true, sth.assigned?(:foo)
|
19
23
|
sth.public_send callee, 0
|
20
24
|
assert_equal false, sth.assign?(:foo)
|
21
25
|
|
@@ -5,7 +5,7 @@ class Test_Striuct_Subclass_Instance_Inference < Test::Unit::TestCase
|
|
5
5
|
def test_inference
|
6
6
|
klass = Striuct.define do
|
7
7
|
member :n, Numeric, inference: true
|
8
|
-
member :m,
|
8
|
+
member :m, BasicObject, inference: true
|
9
9
|
end
|
10
10
|
|
11
11
|
sth, sth2 = klass.new, klass.new
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: striuct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,27 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-05-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: validation
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.0.
|
21
|
+
version: 0.0.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.0.5
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: optionalargument
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: 0.0.3
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.0.3
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: keyvalidatable
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ~>
|
@@ -43,43 +53,81 @@ dependencies:
|
|
43
53
|
version: 0.0.5
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.0.5
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: yard
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
|
-
- -
|
67
|
+
- - ! '>='
|
53
68
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
69
|
+
version: 0.8.6.1
|
70
|
+
- - <
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '2'
|
55
73
|
type: :development
|
56
74
|
prerelease: false
|
57
|
-
version_requirements:
|
75
|
+
version_requirements: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 0.8.6.1
|
81
|
+
- - <
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '2'
|
58
84
|
- !ruby/object:Gem::Dependency
|
59
85
|
name: rake
|
60
|
-
requirement:
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
61
87
|
none: false
|
62
88
|
requirements:
|
63
89
|
- - ! '>='
|
64
90
|
- !ruby/object:Gem::Version
|
65
|
-
version: '
|
91
|
+
version: '10'
|
92
|
+
- - <
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '20'
|
66
95
|
type: :development
|
67
96
|
prerelease: false
|
68
|
-
version_requirements:
|
97
|
+
version_requirements: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '10'
|
103
|
+
- - <
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '20'
|
69
106
|
- !ruby/object:Gem::Dependency
|
70
107
|
name: bundler
|
71
|
-
requirement:
|
108
|
+
requirement: !ruby/object:Gem::Requirement
|
72
109
|
none: false
|
73
110
|
requirements:
|
74
111
|
- - ! '>='
|
75
112
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
113
|
+
version: 1.3.5
|
114
|
+
- - <
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '2'
|
77
117
|
type: :development
|
78
118
|
prerelease: false
|
79
|
-
version_requirements:
|
80
|
-
|
81
|
-
|
82
|
-
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
121
|
+
requirements:
|
122
|
+
- - ! '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.3.5
|
125
|
+
- - <
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '2'
|
128
|
+
description: ! "Struct++ library\n\n Validatable, Inheritable, Member Aliasing,\n
|
129
|
+
\ Conflict Management, Default Value, Divide nil with unassign,\n Lock setter of
|
130
|
+
each member, Hash flendly API, ... And more Struct++ features :)"
|
83
131
|
email:
|
84
132
|
- kachick1+ruby@gmail.com
|
85
133
|
executables: []
|
@@ -172,8 +220,9 @@ files:
|
|
172
220
|
- test/test_subc-i-validation_specific_conditions.rb
|
173
221
|
- test/test_subc-i-validation_with_getter.rb
|
174
222
|
- test/test_version.rb
|
175
|
-
homepage:
|
176
|
-
licenses:
|
223
|
+
homepage: http://kachick.github.com/striuct/
|
224
|
+
licenses:
|
225
|
+
- MIT
|
177
226
|
post_install_message:
|
178
227
|
rdoc_options: []
|
179
228
|
require_paths:
|
@@ -192,10 +241,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
241
|
version: '0'
|
193
242
|
requirements: []
|
194
243
|
rubyforge_project:
|
195
|
-
rubygems_version: 1.8.
|
244
|
+
rubygems_version: 1.8.23
|
196
245
|
signing_key:
|
197
246
|
specification_version: 3
|
198
|
-
summary: Struct++
|
247
|
+
summary: Struct++ library Validatable, Inheritable, Member Aliasing, Conflict Management,
|
248
|
+
Default Value, Divide nil with unassign, Lock setter of each member, Hash flendly
|
249
|
+
API, ... And more Struct++ features :)
|
199
250
|
test_files:
|
200
251
|
- test/helper.rb
|
201
252
|
- test/test_sglc-constructor.rb
|