moosex 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,20 @@
1
+ #require 'simplecov'
2
+ #SimpleCov.start do
3
+ # add_filter '/spec/'
4
+
5
+ # add_group 'core', 'lib'
6
+ # add_group 'test', 'spec'
7
+
8
+ #end
9
+
1
10
  require 'simplecov'
2
- SimpleCov.start do
3
- # add_filter '/spec/'
11
+ require 'coveralls'
4
12
 
5
- add_group 'core', 'lib'
6
- add_group 'test', 'spec'
13
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
14
+ SimpleCov::Formatter::HTMLFormatter,
15
+ Coveralls::SimpleCov::Formatter
16
+ ]
17
+ SimpleCov.start do
18
+ add_filter '/spec/'
19
+ # add_group 'core', 'lib'
7
20
  end
@@ -80,4 +80,4 @@ describe "TriggerTest" do
80
80
 
81
81
  t.attr_lazy_trigger.should == 1
82
82
  end
83
- end
83
+ end
@@ -474,4 +474,4 @@ describe "MooseX::Types" do
474
474
  "hasMethods violation: object 1 (Fixnum) should implement method bar")
475
475
  end
476
476
  end
477
- end
477
+ end
@@ -0,0 +1,43 @@
1
+ require 'moosex'
2
+ require 'weakref'
3
+
4
+ class WeakRefExample
5
+ include MooseX
6
+
7
+ has a: { is: :rw, weak: true }
8
+ has b: { is: :rw, weak: true, default: lambda{ Object.new } }
9
+ has c: { is: :lazy, weak: true, clearer: true }
10
+
11
+ def build_c
12
+ Object.new
13
+ end
14
+ end
15
+
16
+ describe WeakRefExample do
17
+ it "should store an object as a weak reference in :a" do
18
+ e = WeakRefExample.new(a: Object.new)
19
+
20
+ e.a.class.should == WeakRef
21
+ end
22
+
23
+ it "should store an object as a weak reference via writter in :a" do
24
+ e = WeakRefExample.new
25
+
26
+ e.a = Object.new
27
+ e.a.class.should == WeakRef
28
+ end
29
+
30
+ it "should store the default value as a weak reference in :b" do
31
+ e = WeakRefExample.new
32
+
33
+ e.b.class.should == WeakRef
34
+ end
35
+
36
+ it "should store a lazy value as a weak reference in :c" do
37
+ e = WeakRefExample.new
38
+
39
+ e.c.class.should == WeakRef
40
+ e.clear_c!
41
+ e.c.class.should == WeakRef
42
+ end
43
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moosex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Peczenyj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-07 00:00:00.000000000 Z
11
+ date: 2014-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,14 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 0.8.2
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 0.8.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: coveralls
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.7.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 0.7.0
69
83
  description: MooseX is an extension of Ruby object DSL. The main goal of MooseX is
70
84
  to make Ruby Object Oriented programming easier, more consistent, and less tedious.
71
85
  With MooseX you can think more about what you want to do and less about the mechanics
@@ -91,7 +105,10 @@ files:
91
105
  - lib/moosex/types.rb
92
106
  - lib/moosex/version.rb
93
107
  - moosex.gemspec
108
+ - samples/bank_account.rb
109
+ - samples/binary_tree.rb
94
110
  - samples/events.rb
111
+ - samples/human.rb
95
112
  - samples/point.rb
96
113
  - samples/roles.rb
97
114
  - spec/baserole_spec.rb
@@ -113,6 +130,7 @@ files:
113
130
  - spec/spec_helper.rb
114
131
  - spec/trigger_spec.rb
115
132
  - spec/types_spec.rb
133
+ - spec/weak_spec.rb
116
134
  homepage: http://github.com/peczenyj/MooseX
117
135
  licenses:
118
136
  - MIT
@@ -157,3 +175,5 @@ test_files:
157
175
  - spec/spec_helper.rb
158
176
  - spec/trigger_spec.rb
159
177
  - spec/types_spec.rb
178
+ - spec/weak_spec.rb
179
+ has_rdoc: