opal-connect 0.0.14 → 0.0.15

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: 95fb28324af881c61bc29987d3d1fe527e8bb719
4
- data.tar.gz: d6c5afedeb80966c6863c8900dc37e5ed6b37914
3
+ metadata.gz: d1d9d0e4b7880c010ff5b17ff9077031ed0df2e2
4
+ data.tar.gz: 592334826cfa7c6f4fafeca24cdb630967f433ae
5
5
  SHA512:
6
- metadata.gz: 9452f6abcc753dddfc85ad4b786f444ab175f038075646ae0cc387026ac49e05198e86a5b01987417332a661c7353825a1a445e8a3bfad3c43deb8f394e63f03
7
- data.tar.gz: aa24cf63d004be9ae549dfcc6cd85ab7137688216f041ba36a0cef380041f6a031f2a5015ec6f57a1e95d8a367eea679b3e02ec16e83eee889f51eaf8eb91dbe
6
+ metadata.gz: 32529be9df5f1916fdad47bebd6fe9173ee93f775d63cdf809ecf5fe24d3bf8aeca84a70a47bf0c02de33ef018bfd8770e2b2e0306b703ee673be58345a2f167
7
+ data.tar.gz: ebc1ccc26a4fdc011e59286632f5d0f68003380d49b9e818660f884b6cd821e4a46064c4526dfc18dca893e4dacf25939f5b8167ee527f9f3e66f437c31c9f1e
@@ -42,7 +42,7 @@ module Opal
42
42
  end
43
43
 
44
44
  def cache
45
- @cache ||= (Connect.templates[self.name] ||= {})
45
+ @cache ||= (Connect.templates[self.class_name] ||= {})
46
46
  end
47
47
 
48
48
  def html(scope = false, &block)
@@ -66,7 +66,7 @@ module Opal
66
66
 
67
67
  module InstanceMethods
68
68
  def cache
69
- self.class.cache
69
+ @cache ||= Connect.templates[self.class.name]
70
70
  end
71
71
 
72
72
  def dom(selector = false)
@@ -33,7 +33,15 @@ module Opal
33
33
  if new_scope
34
34
  @_scope = new(*args).scope(new_scope || Connect.options[:scope])
35
35
  else
36
- @_scope
36
+ @_scope ||= Connect.options[:scope]
37
+ end
38
+ end
39
+
40
+ def method_missing(method, *args, &block)
41
+ if scope && scope.respond_to?(method, true)
42
+ scope.send(method, *args, &block)
43
+ else
44
+ super
37
45
  end
38
46
  end
39
47
  end
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  module Connect
3
- VERSION = "0.0.14"
3
+ VERSION = "0.0.15"
4
4
  end
5
5
  end
data/lib/opal/connect.rb CHANGED
@@ -39,7 +39,18 @@ module Opal
39
39
  end
40
40
 
41
41
  unless block_given?
42
- options[:setup_blocks].each { |b| Class.new { include Opal::Connect }.instance_exec(&b) }
42
+ options[:setup_blocks].each do |b|
43
+ klass = Class.new do
44
+ include Opal::Connect
45
+
46
+ class << self
47
+ attr_accessor :class_name
48
+ end
49
+ end
50
+ klass.class_name = b[:klass].name
51
+
52
+ klass.instance_exec(&b[:block])
53
+ end
43
54
  end
44
55
  end
45
56
 
@@ -160,7 +171,10 @@ module Opal
160
171
  def setup(&block)
161
172
  if block_given?
162
173
  @_setup_block = block
163
- Connect.options[:setup_blocks] << @_setup_block
174
+ Connect.options[:setup_blocks] << {
175
+ block: @_setup_block,
176
+ klass: self
177
+ }
164
178
  end
165
179
 
166
180
  @_setup_block
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - cj