wedge 0.1.18 → 0.1.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/TODO.md +1 -0
- data/lib/wedge.rb +3 -2
- data/lib/wedge/component.rb +13 -2
- data/lib/wedge/middleware.rb +2 -2
- data/lib/wedge/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 743fe18c109f6fc6b16b080ed8513410c3a858d7
|
4
|
+
data.tar.gz: 80dd49ce133ea492f59f2984153312677e0b50a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eae83cd5489b454594342920755d20fe11d8bc7f6720875276668d022f086c36cb3511949c5173a9a1f75d91ef104caf1ccfd9cc441c5d525d423c4f0c1d9cea
|
7
|
+
data.tar.gz: 37db72b69386af0096898d6370d12d6a2ed6a78c2c97f9d35420d80c831bcc0d91c16ba21465a54a824457c7489d4deacd268a2d4ac1793275f1db35d5e0a7d2
|
data/TODO.md
CHANGED
data/lib/wedge.rb
CHANGED
@@ -26,7 +26,7 @@ class Wedge
|
|
26
26
|
class << self
|
27
27
|
extend Forwardable
|
28
28
|
|
29
|
-
ATTR_ACCESSORS = %i{scope store config events}
|
29
|
+
ATTR_ACCESSORS = %i{scope store config events method_called}
|
30
30
|
|
31
31
|
attr_accessor(*ATTR_ACCESSORS)
|
32
32
|
|
@@ -101,12 +101,13 @@ class Wedge
|
|
101
101
|
end
|
102
102
|
|
103
103
|
%w(store scope).each do |meth|
|
104
|
-
define_method "#{meth}!" do |value|
|
104
|
+
define_method "#{meth}!" do |value, method_called = nil|
|
105
105
|
klass = Class.new(self)
|
106
106
|
ATTR_ACCESSORS.each do |name|
|
107
107
|
klass.instance_variable_set(:"@#{name}", Wedge.instance_variable_get(:"@#{name}").deep_dup)
|
108
108
|
end
|
109
109
|
klass.instance_variable_set(:"@#{meth}", value.deep_dup)
|
110
|
+
klass.instance_variable_set(:"@method_called", method_called) if meth.to_s == 'scope'
|
110
111
|
klass
|
111
112
|
end
|
112
113
|
end
|
data/lib/wedge/component.rb
CHANGED
@@ -4,12 +4,17 @@ class Wedge
|
|
4
4
|
class Component
|
5
5
|
include Methods
|
6
6
|
|
7
|
+
attr_accessor :wedge_method_called
|
8
|
+
|
7
9
|
class << self
|
8
10
|
attr_accessor :wedge_on_count
|
9
11
|
|
10
12
|
def wedge_new(klass, *args, &block)
|
11
13
|
obj = allocate
|
12
14
|
|
15
|
+
# discuss: come up with something better
|
16
|
+
obj.wedge_method_called = klass.method_called
|
17
|
+
|
13
18
|
%w(store scope).each do |meth|
|
14
19
|
if value = klass.send(meth)
|
15
20
|
obj.config.send "#{meth}=", value
|
@@ -331,13 +336,19 @@ class Wedge
|
|
331
336
|
alias_method :function, :wedge_function
|
332
337
|
|
333
338
|
def wedge_from_server?
|
334
|
-
begin
|
339
|
+
begin
|
340
|
+
!(wedge_method_called == caller_locations(1,1)[0].label)
|
341
|
+
rescue
|
342
|
+
true
|
343
|
+
end
|
335
344
|
end
|
336
345
|
alias_method :from_server?, :wedge_from_server?
|
337
346
|
|
347
|
+
alias_method :method_called, :wedge_method_called
|
348
|
+
|
338
349
|
def wedge_from_client?
|
339
350
|
begin
|
340
|
-
caller_locations(1,1)[0].label
|
351
|
+
wedge_method_called == caller_locations(1,1)[0].label
|
341
352
|
rescue
|
342
353
|
false
|
343
354
|
end
|
data/lib/wedge/middleware.rb
CHANGED
@@ -72,12 +72,12 @@ class Wedge
|
|
72
72
|
|
73
73
|
if method_args == '__wedge_data__' && data
|
74
74
|
method_args = [data]
|
75
|
-
res = Wedge.scope!(scope)[name].send(method_called, *method_args) || ''
|
75
|
+
res = Wedge.scope!(scope, method_called)[name].send(method_called, *method_args) || ''
|
76
76
|
else
|
77
77
|
# This used to send things like init, we need a better way to
|
78
78
|
# send client config data to the server
|
79
79
|
# res = scope.wedge(name, data).send(method_called, *method_args) || ''
|
80
|
-
res = Wedge.scope!(scope)[name].send(method_called, *method_args) || ''
|
80
|
+
res = Wedge.scope!(scope, method_called)[name].send(method_called, *method_args) || ''
|
81
81
|
end
|
82
82
|
|
83
83
|
# discuss: I don't think we should update the csrf token # every ajax call
|
data/lib/wedge/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wedge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|