clearwater 1.0.0.rc1 → 1.0.0.rc2

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: 7a977102139bfa209ce1a27d10bb2a54c62f8fde
4
- data.tar.gz: 16d3f137ac9d4d7c613f9b3d5e82ea761d72bc62
3
+ metadata.gz: 5db375a0696ec574fae4263215dfde5ba4b0af97
4
+ data.tar.gz: bdf36853856326f64742bd6f2d075727f1514713
5
5
  SHA512:
6
- metadata.gz: 5bb2ad0849af13dd873b464a59d7c38c0d9f259b86277d6b0067b3ece77d94ff8ffd84b496f2833d778e643f6b8cf27aa70c0a5a60d53e53a3040a01414dc055
7
- data.tar.gz: 8aaee323980734782f5751707c5082e4071ea777fede96a562ef63acf4c6b6b6aee6f1a062c610d48de84fb529ccc172031adaf578b2ba90e0b6af605eff690e
6
+ metadata.gz: 50d6c60d11599bcfcd3935c7ebccfb86c11f6f85b1873c998e18ccd5b4b5f2107b5b0f3ff1d609d2dc22edd0fe25f19cfdecc735750820eaf7fa142711d69e84
7
+ data.tar.gz: 28a9a411ffe93d08ea8a9c0749574ac0ade1b144645013d00d60b2e5893c1fac58c5432d1cd358b2486a31933988e409368d45024a7556f21695780b2fccb16f
@@ -1,3 +1,3 @@
1
1
  module Clearwater
2
- VERSION = "1.0.0.rc1"
2
+ VERSION = "1.0.0.rc2"
3
3
  end
@@ -43,6 +43,11 @@ module Clearwater
43
43
  render_current_url &block
44
44
  watch_url
45
45
  end
46
+ alias mount call
47
+
48
+ def unmount
49
+ AppRegistry.delete self
50
+ end
46
51
 
47
52
  def watch_url
48
53
  unless @watching_url
@@ -78,10 +83,19 @@ module Clearwater
78
83
 
79
84
  def benchmark message
80
85
  if debug?
81
- start = `performance.now()`
82
- result = yield
83
- finish = `performance.now()`
84
- puts "#{message} in #{(finish - start).round(3)}ms"
86
+ result = nil
87
+
88
+ if `!!(console.time && console.timeEnd)`
89
+ `console.time(message)`
90
+ result = yield
91
+ `console.timeEnd(message)`
92
+ else
93
+ start = `performance.now()`
94
+ result = yield
95
+ finish = `performance.now()`
96
+ puts "#{message} in #{(finish - start).round(3)}ms"
97
+ end
98
+
85
99
  result
86
100
  else
87
101
  yield
@@ -10,7 +10,7 @@ module Clearwater
10
10
  end
11
11
 
12
12
  def self.sanitize_attributes attributes
13
- return attributes unless attributes.is_a? Hash
13
+ return attributes unless `!!attributes.$$is_hash`
14
14
 
15
15
  attributes.each do |key, value|
16
16
  if `key.slice(0, 2)` == 'on'
@@ -5,9 +5,18 @@ module Clearwater
5
5
  end
6
6
 
7
7
  def unmount node, previous
8
+ @node = nil
9
+ end
10
+
11
+ def mounted?
12
+ !!@node
8
13
  end
9
14
 
10
15
  def method_missing *args, &block
16
+ if @node.nil?
17
+ raise TypeError, "#{self} has not been mounted, received #{args}"
18
+ end
19
+
11
20
  @node.public_send *args, &block
12
21
  end
13
22
 
@@ -70,8 +70,18 @@ module VirtualDOM
70
70
  end
71
71
 
72
72
  module StringUtils
73
+ # Speed up camelization like whoa.
74
+ %x{ var camelized_cache = {}; }
75
+
73
76
  def self.camelize string
74
- `string.replace(/_(\w)/g, self.$_camelize_handler)`
77
+ %x{
78
+ if(camelized_cache.hasOwnProperty(string)) {
79
+ return camelized_cache[string];
80
+ } else {
81
+ camelized_cache[string] = string.replace(/_(\w)/g, self.$_camelize_handler);
82
+ return camelized_cache[string];
83
+ }
84
+ }
75
85
  end
76
86
 
77
87
  def self._camelize_handler _, character_match
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clearwater
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc1
4
+ version: 1.0.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Gaskins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-25 00:00:00.000000000 Z
11
+ date: 2016-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.1.5
33
+ version: '0.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.1.5
40
+ version: '0.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  version: 1.3.1
164
164
  requirements: []
165
165
  rubyforge_project:
166
- rubygems_version: 2.4.8
166
+ rubygems_version: 2.6.6
167
167
  signing_key:
168
168
  specification_version: 4
169
169
  summary: Front-end Ruby web framework for fast, reasonable, and composable applications