reactrb 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -0
- data/lib/react/component/tags.rb +12 -5
- data/lib/reactive-ruby/version.rb +1 -1
- data/spec/react/dsl_spec.rb +12 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd3c6c8b1cf5d2a684020ee3d320fe5ac37c340e
|
4
|
+
data.tar.gz: ac90157aefeb57a7ffecaa3d9f5782ed1d428de7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0d14776cd42b7b2fac9a03da13f9132e27fe544b6f323e8f92ee947f02e253c1a226ef813e73cbdcb56d89446694caa1bca7082b5c88d22c48bae6ab48736a5
|
7
|
+
data.tar.gz: fad34a83a2b6ab81438e8e0db5c37590c07a18bcaa27afeb1e10bfefe4784cffee4ae31f500515e86150b076b9ef82f6227b2a7238c32694af976fd80ac61652
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file starting with v0.8.6.
|
4
|
+
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
|
+
|
6
|
+
Changes are grouped as follows:
|
7
|
+
- **Added** for new features.
|
8
|
+
- **Changed** for changes in existing functionality.
|
9
|
+
- **Deprecated** for once-stable features removed in upcoming releases.
|
10
|
+
- **Removed** for deprecated features removed in this release.
|
11
|
+
- **Fixed** for any bug fixes.
|
12
|
+
- **Security** to invite users to upgrade in case of vulnerabilities.
|
13
|
+
|
14
|
+
<!--
|
15
|
+
Whitespace conventions:
|
16
|
+
- 4 spaces before ## titles
|
17
|
+
- 2 spaces before ### titles
|
18
|
+
- 1 spaces before normal text
|
19
|
+
-->
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
## [0.8.6] - 2016-06-30
|
25
|
+
|
26
|
+
|
27
|
+
### Fixed
|
28
|
+
|
29
|
+
- Method missing within a component was being reported as `incorrect const name` (#151)
|
data/lib/react/component/tags.rb
CHANGED
@@ -83,13 +83,20 @@ module React
|
|
83
83
|
private
|
84
84
|
|
85
85
|
def find_component(name)
|
86
|
-
|
86
|
+
component = lookup_const(name)
|
87
|
+
if component && !component.method_defined?(:render)
|
88
|
+
raise "#{name} does not appear to be a react component."
|
89
|
+
end
|
90
|
+
component
|
91
|
+
end
|
92
|
+
|
93
|
+
def lookup_const(name)
|
94
|
+
return nil unless name =~ /^[A-Z]/
|
95
|
+
scopes = self.class.name.to_s.split('::').inject([Module]) do |nesting, next_const|
|
87
96
|
nesting + [nesting.last.const_get(next_const)]
|
88
97
|
end.reverse
|
89
|
-
scope = scopes.detect { |s| s.const_defined?(name) }
|
90
|
-
|
91
|
-
return component if component.method_defined?(:render)
|
92
|
-
raise "#{name} does not appear to be a react component."
|
98
|
+
scope = scopes.detect { |s| s.const_defined?(name) }
|
99
|
+
scope.const_get(name) if scope
|
93
100
|
end
|
94
101
|
end
|
95
102
|
end
|
data/spec/react/dsl_spec.rb
CHANGED
@@ -153,6 +153,18 @@ describe 'the React DSL' do
|
|
153
153
|
.to raise_error('Comp does not appear to be a react component.')
|
154
154
|
end
|
155
155
|
|
156
|
+
it 'raises a method missing error' do
|
157
|
+
stub_const 'Foo', Class.new(React::Component::Base)
|
158
|
+
Foo.class_eval do
|
159
|
+
backtrace :none
|
160
|
+
render do
|
161
|
+
_undefined_method
|
162
|
+
end
|
163
|
+
end
|
164
|
+
expect { React.render_to_static_markup(React.create_element(Foo)) }
|
165
|
+
.to raise_error(NoMethodError)
|
166
|
+
end
|
167
|
+
|
156
168
|
it "will treat the component class name as a first class component name" do
|
157
169
|
stub_const 'Mod::Bar', Class.new
|
158
170
|
Mod::Bar.class_eval do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reactrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Chang
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-06-
|
13
|
+
date: 2016-06-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: opal
|
@@ -232,6 +232,7 @@ files:
|
|
232
232
|
- ".gitignore"
|
233
233
|
- ".rubocop.yml"
|
234
234
|
- ".travis.yml"
|
235
|
+
- CHANGELOG.md
|
235
236
|
- Gemfile
|
236
237
|
- LICENSE
|
237
238
|
- README.md
|