welo 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/TODO +6 -7
- data/lib/welo/core/observation.rb +35 -0
- data/lib/welo.rb +2 -1
- metadata +7 -3
data/Rakefile
CHANGED
data/TODO
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
* Relationships
|
2
|
-
- we have :one, :many, we should be able to have, exactly_four, or one_per_foo
|
3
|
-
* Epitheting vs. Nesting vs. Identifying
|
4
|
-
- remove alias from Relationship and create a similar Epiteth object?
|
5
1
|
* Embeddings
|
6
|
-
-
|
7
|
-
-
|
8
|
-
*
|
2
|
+
- merge the branch
|
3
|
+
- use the complex serialization overhead only when needed loaded
|
4
|
+
* Observations
|
5
|
+
- make them more useful
|
6
|
+
* Proxies
|
7
|
+
- a class like observations
|
@@ -0,0 +1,35 @@
|
|
1
|
+
|
2
|
+
module Welo
|
3
|
+
ObservationStruct = Class.new(Struct) do
|
4
|
+
class << self
|
5
|
+
attr_accessor :maker, :perspective
|
6
|
+
def for_hash(hash)
|
7
|
+
vals = members.map do |k|
|
8
|
+
hash[k]
|
9
|
+
end
|
10
|
+
self.new(*vals)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class ObservationMaker
|
16
|
+
attr_accessor :resource, :structures
|
17
|
+
def initialize(res=nil)
|
18
|
+
@resource = res
|
19
|
+
@structures = {}
|
20
|
+
end
|
21
|
+
|
22
|
+
def structure(name=:default, &blk)
|
23
|
+
@structures[name] ||= create_structure!(name, &blk)
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_structure!(name, &blk)
|
27
|
+
persp = resource.perspective(name)
|
28
|
+
raise ArgumentError.new("no such perspective: #{name} for #{resource}") unless persp
|
29
|
+
st = ObservationStruct.new(*persp.fields, &blk)
|
30
|
+
st.maker = self
|
31
|
+
st.perspective = name
|
32
|
+
st
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/welo.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: welo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 17
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- crapooze
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2011-
|
18
|
+
date: 2011-03-03 00:00:00 +01:00
|
18
19
|
default_executable:
|
19
20
|
dependencies: []
|
20
21
|
|
@@ -36,6 +37,7 @@ files:
|
|
36
37
|
- lib/welo/core/link.rb
|
37
38
|
- lib/welo/core/matcher.rb
|
38
39
|
- lib/welo/core/nesting.rb
|
40
|
+
- lib/welo/core/observation.rb
|
39
41
|
- lib/welo/core/perspective.rb
|
40
42
|
- lib/welo/base/resource.rb
|
41
43
|
has_rdoc: true
|
@@ -52,6 +54,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
52
54
|
requirements:
|
53
55
|
- - ">="
|
54
56
|
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
55
58
|
segments:
|
56
59
|
- 0
|
57
60
|
version: "0"
|
@@ -60,6 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
63
|
requirements:
|
61
64
|
- - ">="
|
62
65
|
- !ruby/object:Gem::Version
|
66
|
+
hash: 3
|
63
67
|
segments:
|
64
68
|
- 0
|
65
69
|
version: "0"
|