little_wheels 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/little_wheels.rb +26 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7366ace87bb341e2c4bfb019995eb3a167d3226827e13c0f281627e4766df1c8
|
4
|
+
data.tar.gz: c036705390e96b03ad3da97a058a074f8e8cd4203c76c61577f6a2e46cad3a06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f354ab4ede76e3c7c22a47a7fd32fc7b13c2912227a7fd0c1a2fe204b683642c8264d63f2406db4b99c7f124a3e6a8bb967ce8ab6bdc4cbf64ab21f28084de99
|
7
|
+
data.tar.gz: 3b7f8431bf6aa8ab06a76b7e62696a2ad0e551c35934a9cfae889fdd8bb8eba1aabcecdd50ffd97ee4173861cba079f9fa503e164231c4f76ed5bac00c9377de
|
data/lib/little_wheels.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module LittleWheels
|
2
|
-
VERSION = "0.0.
|
2
|
+
VERSION = "0.0.7"
|
3
3
|
|
4
4
|
class Component
|
5
5
|
def t(template, **locals)
|
@@ -9,9 +9,29 @@ module LittleWheels
|
|
9
9
|
def t!(template, **locals)
|
10
10
|
renderer.render(template, locals:, layout: nil)
|
11
11
|
end
|
12
|
+
|
13
|
+
def x
|
14
|
+
renderer.helpers.tag
|
15
|
+
end
|
12
16
|
|
13
17
|
def to_s
|
14
|
-
|
18
|
+
renderer.helpers.capture do
|
19
|
+
if self.class.const_defined?(:TEMPLATE)
|
20
|
+
t(self.class.const_get(:TEMPLATE), c: self, x: self.x )
|
21
|
+
else
|
22
|
+
t!("shared/#{default_template_name}", c: self, x: self.x )
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def accepts_slot(block)
|
28
|
+
@_slot = block
|
29
|
+
end
|
30
|
+
|
31
|
+
def slot
|
32
|
+
context = @_slot.binding.receiver
|
33
|
+
|
34
|
+
context.capture(&@_slot)
|
15
35
|
end
|
16
36
|
|
17
37
|
def renderer
|
@@ -21,5 +41,9 @@ module LittleWheels
|
|
21
41
|
def default_template_name
|
22
42
|
self.class.name.underscore
|
23
43
|
end
|
44
|
+
|
45
|
+
def capture(&block)
|
46
|
+
block.call.to_s.html_safe
|
47
|
+
end
|
24
48
|
end
|
25
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: little_wheels
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregory Brown
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Potential future implementation of the smallest Rails component library
|
14
14
|
that can possibly work.
|