rbexy 0.1.5 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +10 -0
- data/lib/rbexy/component_providers/namespaced_rbexy_provider.rb +20 -0
- data/lib/rbexy/component_providers/rbexy_provider.rb +0 -2
- data/lib/rbexy/component_providers/view_component_provider.rb +0 -2
- data/lib/rbexy/rails.rb +0 -1
- data/lib/rbexy/rails/engine.rb +3 -0
- data/lib/rbexy/runtime.rb +11 -1
- data/lib/rbexy/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 563f7d14586235a18249e38e8859824b7952617b4984ab794e69963c218b41b2
|
4
|
+
data.tar.gz: a20d77a9a3d2fc439d425033fcb3230d18f59a98990a50be022569de163e67cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48a530ceee5c8b30f7c41900db8b5b0658351a5ab397af004bc9b38c1047d1bb62eecc0ee4807bc992d690d50dabf5d291a15aadc7c27975cc6901bae8985ec1
|
7
|
+
data.tar.gz: 4e5713408292969214aeb92909f522dd59f823f847ece59bb016e55e0993eb2d3c51fd0434ebaab3447f939f32833600da4c466fdacb5d3632b4201dea7c7e13
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -375,6 +375,16 @@ Rbexy.configure do |config|
|
|
375
375
|
end
|
376
376
|
```
|
377
377
|
|
378
|
+
Or in Rails you can customize the component provider just for a controller:
|
379
|
+
|
380
|
+
```ruby
|
381
|
+
class ThingsController < ApplicationController
|
382
|
+
def rbexy_component_provider
|
383
|
+
MyComponentProvider.new
|
384
|
+
end
|
385
|
+
end
|
386
|
+
```
|
387
|
+
|
378
388
|
See `lib/rbexy/component_providers/` for example implementations.
|
379
389
|
|
380
390
|
## Usage outside of Rails
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Rbexy
|
2
|
+
module ComponentProviders
|
3
|
+
class NamespacedRbexyProvider < Rbexy::ComponentProviders::RbexyProvider
|
4
|
+
attr_reader :namespaces
|
5
|
+
|
6
|
+
def initialize(*namespaces)
|
7
|
+
@namespaces = namespaces
|
8
|
+
end
|
9
|
+
|
10
|
+
def find(name)
|
11
|
+
namespaces.each do |namespace|
|
12
|
+
result = super("#{namespace}::#{name}")
|
13
|
+
return result if result != nil
|
14
|
+
end
|
15
|
+
|
16
|
+
super
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/rbexy/rails.rb
CHANGED
data/lib/rbexy/rails/engine.rb
CHANGED
data/lib/rbexy/runtime.rb
CHANGED
@@ -11,7 +11,11 @@ module Rbexy
|
|
11
11
|
|
12
12
|
DefaultTagBuilder = ActionView::Helpers::TagHelper::TagBuilder
|
13
13
|
|
14
|
-
def self.create_tag_builder(context, provider =
|
14
|
+
def self.create_tag_builder(context, provider = nil)
|
15
|
+
provider = provider ||
|
16
|
+
provider_from_context(context) ||
|
17
|
+
Rbexy.configuration.component_provider
|
18
|
+
|
15
19
|
if provider
|
16
20
|
ComponentTagBuilder.new(context, provider)
|
17
21
|
else
|
@@ -19,6 +23,12 @@ module Rbexy
|
|
19
23
|
end
|
20
24
|
end
|
21
25
|
|
26
|
+
def self.provider_from_context(context)
|
27
|
+
if context.respond_to?(:rbexy_component_provider)
|
28
|
+
context.rbexy_component_provider
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
22
32
|
def initialize(component_provider = nil)
|
23
33
|
@rbexy_tag = self.class.create_tag_builder(self, component_provider)
|
24
34
|
end
|
data/lib/rbexy/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbexy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Giancola
|
@@ -224,6 +224,7 @@ files:
|
|
224
224
|
- example.rb
|
225
225
|
- lib/rbexy.rb
|
226
226
|
- lib/rbexy/component.rb
|
227
|
+
- lib/rbexy/component_providers/namespaced_rbexy_provider.rb
|
227
228
|
- lib/rbexy/component_providers/rbexy_provider.rb
|
228
229
|
- lib/rbexy/component_providers/view_component_provider.rb
|
229
230
|
- lib/rbexy/component_tag_builder.rb
|