roda-component 0.1.52 → 0.1.53

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1831421424b4a48caa2c4a22ae56d5fbd083bfdb
4
- data.tar.gz: 490c5c522f40e53665c6c8e5d4a598ef42f3a294
3
+ metadata.gz: 41c126a7621dc0b571681e4ddd74ff0c35c13e89
4
+ data.tar.gz: 1255952e2020d8b3d54b536cbc96f52280ac7b43
5
5
  SHA512:
6
- metadata.gz: 3bc9310ce9113ab4cf24f88741de18e25ce1519e6a47217637807465ece06fe3b806c24412c85cb7383025feb34deee7d0b6c21639cb6580d0177f937d7b9294
7
- data.tar.gz: 8bbdc5768e81727ae1a2625067f10ed4d2fa26954bc26a9aaa39077c54c5f9b8aaaf784fab392b17d8f54a026346a14f74fd8dfdd891c7401134ac621a7552f0
6
+ metadata.gz: 6325870641c04381f926fee8a2153df4aebcc819aa2a75618866cba97e40a26c2ad8fd09abbf4d0a1f3487c78095e6bb120b8a8c419858f9eeabf91f310b32af
7
+ data.tar.gz: 5740196694645b1365fd931074d86d5f7cac36f414c301d74764fa54987b215d3311354a985aa31f17e901e18416ce4beb469118418073b29006b903a360ae23
@@ -1,5 +1,5 @@
1
1
  class Roda
2
2
  class Component
3
- VERSION = "0.1.52"
3
+ VERSION = "0.1.53"
4
4
  end
5
5
  end
@@ -124,7 +124,7 @@ class Roda
124
124
  end
125
125
 
126
126
  class << self
127
- attr_accessor :_name
127
+ attr_accessor :_name, :_on_server_methods
128
128
 
129
129
  def file_location
130
130
  @_file_location
@@ -162,12 +162,16 @@ class Roda
162
162
  end
163
163
 
164
164
  def on_server &block
165
+ @_on_server_methods ||= []
166
+
165
167
  if server?
166
168
  m = Module.new(&block)
167
169
 
168
170
  yield
169
171
 
170
172
  m.public_instance_methods(false).each do |meth|
173
+ @_on_server_methods << meth.to_s
174
+
171
175
  alias_method :"original_#{meth}", :"#{meth}"
172
176
  define_method "#{meth}" do |*args, &blk|
173
177
  o_name = "original_#{meth}"
@@ -185,6 +189,8 @@ class Roda
185
189
  m = Module.new(&block)
186
190
 
187
191
  m.public_instance_methods(false).each do |meth|
192
+ @_on_server_methods << meth.to_s
193
+
188
194
  define_method "#{meth}" do |*args, &blk|
189
195
  name = self.class._name
190
196
  # event_id = "comp-event-#{$faye.generate_id}"
@@ -117,11 +117,11 @@ class Roda
117
117
 
118
118
  Document.ready? do
119
119
  c.events.trigger_jquery_events
120
- c.#{action}(JSON.parse(Base64.decode64('#{options}'))) if action != 'false'
120
+ c.#{action}(JSON.parse(Base64.decode64('#{options}'))) if !(c.class._on_server_methods || []).include?('#{action}') && action != 'false'
121
121
  end
122
122
 
123
123
  Document.on 'page:load' do
124
- c.#{action}(JSON.parse(Base64.decode64('#{options}'))) if action != 'false'
124
+ c.#{action}(JSON.parse(Base64.decode64('#{options}'))) if !(c.class._on_server_methods || []).include?('#{action}') && action != 'false'
125
125
  end
126
126
  `}).fail(function(jqxhr, settings, exception){ window.console.log(exception); });`
127
127
  elsif $component_opts[:comp][:"#{comp_name}"] && $component_opts[:comp][:"#{comp_name}"][:class]
@@ -131,7 +131,7 @@ class Roda
131
131
  c = $component_opts[:comp][:"#{comp_name}"][:class] = #{comp.class}.new(JSON.parse(Base64.decode64('#{options}')))
132
132
  end
133
133
  c.instance_variable_set(:@_cache, $component_opts[:comp][:"#{comp_name}"][:cache])
134
- c.#{action}(JSON.parse(Base64.decode64('#{options}'))) if action != 'false'
134
+ c.#{action}(JSON.parse(Base64.decode64('#{options}'))) if !(c.class._on_server_methods || []).include?('#{action}') && action != 'false'
135
135
  end
136
136
  EOF
137
137
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roda-component
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.52
4
+ version: 0.1.53
5
5
  platform: ruby
6
6
  authors:
7
7
  - cj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-03 00:00:00.000000000 Z
11
+ date: 2015-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal