freightrain 0.5.11 → 0.5.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/lib/freightrain/binding/freight_binding.rb +5 -11
- data/lib/freightrain/freight_view_model.rb +17 -9
- metadata +2 -2
data/Rakefile
CHANGED
@@ -3,6 +3,8 @@ module Freightrain
|
|
3
3
|
|
4
4
|
class FreightBinding
|
5
5
|
|
6
|
+
attr_accessor :data_source
|
7
|
+
|
6
8
|
def initialize(widget, options)
|
7
9
|
@cache = :__NOVALUE
|
8
10
|
@widget = widget
|
@@ -12,14 +14,6 @@ module Freightrain
|
|
12
14
|
@force = options[:force]
|
13
15
|
end
|
14
16
|
|
15
|
-
def data_source
|
16
|
-
return @data_source
|
17
|
-
end
|
18
|
-
|
19
|
-
def data_source=(source)
|
20
|
-
@data_source = source
|
21
|
-
end
|
22
|
-
|
23
17
|
def update()
|
24
18
|
begin
|
25
19
|
value = get(data_source, @path)
|
@@ -28,9 +22,9 @@ module Freightrain
|
|
28
22
|
@cache = value
|
29
23
|
end
|
30
24
|
rescue Exception => ex
|
31
|
-
p "#{@widget.name} - update"
|
32
|
-
p ex.message
|
33
|
-
p @path
|
25
|
+
# p "#{@widget.name} - update"
|
26
|
+
# p ex.message
|
27
|
+
# p @path
|
34
28
|
end
|
35
29
|
end
|
36
30
|
|
@@ -18,17 +18,25 @@ module Freightrain
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
def self.new(*args, &block)
|
22
|
+
viewmodel = allocate
|
23
|
+
viewmodel.bootstrap
|
24
|
+
viewmodel.send(:initialize, *args, &block)
|
25
|
+
return viewmodel
|
26
|
+
end
|
27
|
+
|
28
|
+
def bootstrap
|
29
|
+
view = Freightrain[self.class.name.sub("Model", "").to_convention_sym]
|
30
|
+
self.get_services
|
31
|
+
self.build_regions
|
32
|
+
self.create_signals
|
33
|
+
view.hook_to_signals(self)
|
34
|
+
self.services.each do |service_key|
|
35
|
+
service = self.instance_variable_get("@#{service_key}")
|
29
36
|
service.hook_to_signals(self, service_key)
|
30
37
|
end
|
31
|
-
|
38
|
+
view.data_source = self
|
39
|
+
@view = view
|
32
40
|
end
|
33
41
|
|
34
42
|
def show
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freightrain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrea Dallera
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-03-
|
12
|
+
date: 2010-03-16 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|