classx 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +84 -0
- data/README +4 -2
- data/Rakefile +1 -1
- data/bench/attribute_set.rb +56 -0
- data/bench/initialize.rb +59 -0
- data/doc/output/coverage/-Library-Ruby-Gems-gems-diff-lcs-1_1_2-lib-diff-lcs-block_rb.html +1 -1
- data/doc/output/coverage/-Library-Ruby-Gems-gems-diff-lcs-1_1_2-lib-diff-lcs-callbacks_rb.html +1 -1
- data/doc/output/coverage/-Library-Ruby-Gems-gems-diff-lcs-1_1_2-lib-diff-lcs-change_rb.html +1 -1
- data/doc/output/coverage/-Library-Ruby-Gems-gems-diff-lcs-1_1_2-lib-diff-lcs-hunk_rb.html +1 -1
- data/doc/output/coverage/-Library-Ruby-Gems-gems-diff-lcs-1_1_2-lib-diff-lcs_rb.html +1 -1
- data/doc/output/coverage/-Library-Ruby-Gems-gems-rcov-0_8_1_2_0-lib-rcov_rb.html +1 -1
- data/doc/output/coverage/index.html +27 -27
- data/doc/output/coverage/lib-classx-attribute_rb.html +82 -75
- data/doc/output/coverage/lib-classx-attributes_rb.html +101 -94
- data/doc/output/coverage/lib-classx-validate_rb.html +14 -11
- data/doc/output/coverage/lib-classx_rb.html +75 -65
- data/example/commandable.rb +9 -3
- data/lib/classx.rb +12 -2
- data/lib/classx/attribute.rb +10 -3
- data/lib/classx/attributes.rb +10 -3
- data/lib/classx/commandable.rb +27 -7
- data/lib/classx/declare.rb +12 -0
- data/lib/classx/role/logger.rb +70 -0
- data/lib/classx/validate.rb +6 -3
- data/spec/classx/default_option_spec.rb +16 -12
- data/spec/classx/handles_spec.rb +5 -2
- data/spec/classx/with_coerce.rb +12 -4
- data/spec/classx/with_extend.rb +3 -1
- data/spec/classx/with_include.rb +3 -1
- data/spec/classx/with_multiple_class_spec.rb +4 -2
- data/spec/classx/without_accessor_spec.rb +2 -1
- data/spec/classx/without_anyoption_spec.rb +3 -1
- data/spec/classx/writable_option_spec.rb +8 -4
- data/spec/classx_attributes_spec.rb +6 -1
- data/tasks/basic_config.rake +1 -1
- metadata +7 -2
data/spec/classx/with_include.rb
CHANGED
@@ -5,7 +5,7 @@ describe ClassX do
|
|
5
5
|
describe '#has' do
|
6
6
|
describe 'with include' do
|
7
7
|
before do
|
8
|
-
@class = Class.new
|
8
|
+
@class = Class.new
|
9
9
|
mod = Module.new
|
10
10
|
mod.module_eval do
|
11
11
|
define_method :test do
|
@@ -13,6 +13,8 @@ describe ClassX do
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
@class.class_eval do
|
16
|
+
include ClassX
|
17
|
+
|
16
18
|
has :x, :include => mod
|
17
19
|
end
|
18
20
|
end
|
@@ -5,12 +5,14 @@ describe ClassX do
|
|
5
5
|
describe '#has' do
|
6
6
|
describe 'with multiple class' do
|
7
7
|
before do
|
8
|
-
@class1 = Class.new
|
8
|
+
@class1 = Class.new
|
9
9
|
@class1.class_eval do
|
10
|
+
include ClassX
|
10
11
|
has :x
|
11
12
|
end
|
12
|
-
@class2 = Class.new
|
13
|
+
@class2 = Class.new
|
13
14
|
@class2.class_eval do
|
15
|
+
include ClassX
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
@@ -6,8 +6,9 @@ describe ClassX do
|
|
6
6
|
describe 'with :writable option' do
|
7
7
|
describe 'when you specify false for attribute' do
|
8
8
|
before do
|
9
|
-
@class = Class.new
|
9
|
+
@class = Class.new
|
10
10
|
@class.class_eval do
|
11
|
+
include ClassX
|
11
12
|
has :x, :writable => false
|
12
13
|
end
|
13
14
|
end
|
@@ -27,8 +28,9 @@ describe ClassX do
|
|
27
28
|
|
28
29
|
describe 'when you specify true for attribute' do
|
29
30
|
before do
|
30
|
-
@class = Class.new
|
31
|
+
@class = Class.new
|
31
32
|
@class.class_eval do
|
33
|
+
include ClassX
|
32
34
|
has :x, :writable => true
|
33
35
|
end
|
34
36
|
end
|
@@ -51,8 +53,9 @@ describe ClassX do
|
|
51
53
|
describe 'with :writable is false' do
|
52
54
|
it 'should raise ClassX::OptionalAttrShouldBeWritable' do
|
53
55
|
lambda {
|
54
|
-
klass = Class.new
|
56
|
+
klass = Class.new
|
55
57
|
klass.class_eval do
|
58
|
+
include ClassX
|
56
59
|
has :x, :optional => true, :writable => false
|
57
60
|
end
|
58
61
|
}.should raise_error(ClassX::OptionalAttrShouldBeWritable)
|
@@ -62,8 +65,9 @@ describe ClassX do
|
|
62
65
|
describe 'with :writable is true' do
|
63
66
|
it 'should not raise ClassX::OptionalAttrShouldBeWritable' do
|
64
67
|
lambda {
|
65
|
-
klass = Class.new
|
68
|
+
klass = Class.new
|
66
69
|
klass.class_eval do
|
70
|
+
include ClassX
|
67
71
|
has :x, :optional => true, :writable => true
|
68
72
|
end
|
69
73
|
}.should_not raise_error(ClassX::OptionalAttrShouldBeWritable)
|
@@ -21,10 +21,15 @@ describe ClassX::Attributes do
|
|
21
21
|
has :x, :default => 10
|
22
22
|
end
|
23
23
|
|
24
|
-
klass = Class.new
|
24
|
+
klass = Class.new
|
25
25
|
klass.class_eval do
|
26
|
+
include ClassX
|
26
27
|
include mod
|
28
|
+
|
29
|
+
has :y, :default => 10
|
27
30
|
end
|
31
|
+
|
28
32
|
klass.new.x.should == 10
|
33
|
+
klass.new.y.should == 10
|
29
34
|
end
|
30
35
|
end
|
data/tasks/basic_config.rake
CHANGED
@@ -14,7 +14,7 @@ RDOC_OPTS = [
|
|
14
14
|
DEFAULT_EXTRA_RDOC_FILES = ['README', 'ChangeLog']
|
15
15
|
PKG_FILES = [ 'Rakefile' ] +
|
16
16
|
DEFAULT_EXTRA_RDOC_FILES +
|
17
|
-
Dir.glob('{bin,lib,test,spec,doc,example,tasks,script,generator,templates,extras,website}/**/*') +
|
17
|
+
Dir.glob('{bin,lib,test,spec,doc,bench,example,tasks,script,generator,templates,extras,website}/**/*') +
|
18
18
|
Dir.glob('ext/**/*.{h,c,rb}') +
|
19
19
|
Dir.glob('examples/**/*.rb') +
|
20
20
|
Dir.glob('tools/*.rb')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: classx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keiji, Yoshimi
|
@@ -9,7 +9,7 @@ autorequire: ""
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-08-
|
12
|
+
date: 2008-08-23 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -39,7 +39,10 @@ files:
|
|
39
39
|
- lib/classx/attribute.rb
|
40
40
|
- lib/classx/attributes.rb
|
41
41
|
- lib/classx/commandable.rb
|
42
|
+
- lib/classx/declare.rb
|
42
43
|
- lib/classx/include
|
44
|
+
- lib/classx/role
|
45
|
+
- lib/classx/role/logger.rb
|
43
46
|
- lib/classx/validate.rb
|
44
47
|
- lib/classx.rb
|
45
48
|
- spec/classx
|
@@ -69,6 +72,8 @@ files:
|
|
69
72
|
- doc/output/coverage/lib-classx-attributes_rb.html
|
70
73
|
- doc/output/coverage/lib-classx-validate_rb.html
|
71
74
|
- doc/output/coverage/lib-classx_rb.html
|
75
|
+
- bench/attribute_set.rb
|
76
|
+
- bench/initialize.rb
|
72
77
|
- example/commandable.rb
|
73
78
|
- tasks/basic_config.rake
|
74
79
|
- tasks/basic_tasks.rake
|