snabberb 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/snabberb/version.rb +1 -1
- data/lib/snabberb.rb +4 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eb7d55b5b19a6c6ffaa167950fbbf680820db02e48b822e8ff549ca8359ee1e
|
4
|
+
data.tar.gz: bed391d52d2fe3802a41a9f01852a6f3aaa204df2b2b5771a204860044d49910
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6078202977bcef2d48f546d53325d503f702a473d01374b7d322f08e0166fb57cd7eb01702cf4992078249e5c1ac70933a07ce67ed59515b6800e980581a31e7
|
7
|
+
data.tar.gz: a13532e40fd2f2bdeefebea9d6366ce5179b1254f9ccfe467368db89a5500fe47d2b3e7bca9cf9db3719f93c8c0892b2936e69408757cc6b061544015b856edf
|
data/README.md
CHANGED
@@ -154,9 +154,9 @@ A detailed example can be found [in the Roda example](examples/roda).
|
|
154
154
|
|
155
155
|
You can generate HTML from a component with a file.
|
156
156
|
|
157
|
-
Snabberb.html('path/to/my\_component.rb', **needs)
|
157
|
+
Snabberb.html\_script('path/to/my\_component.rb', **needs)
|
158
158
|
|
159
|
-
This reads in the ruby file at the path and calls html on the CamelCased version of the file name.
|
159
|
+
This reads in the ruby file at the path and generates javascript that calls html on the CamelCased version of the file name.
|
160
160
|
|
161
161
|
## Installation
|
162
162
|
|
data/lib/snabberb/version.rb
CHANGED
data/lib/snabberb.rb
CHANGED
@@ -40,15 +40,17 @@ module Snabberb
|
|
40
40
|
|
41
41
|
# takes in a file and needs
|
42
42
|
# calls html on the CamelCased version of the file with the needs
|
43
|
-
def self.
|
43
|
+
def self.html_script(file, **needs)
|
44
44
|
klass = file.split('/').last
|
45
45
|
.split('.').first
|
46
46
|
.split('_').map(&:capitalize).join
|
47
47
|
|
48
|
-
<<~RUBY
|
48
|
+
script = <<~RUBY
|
49
49
|
#{File.read(file)}
|
50
50
|
#{klass}.html(`#{wrap(needs)}`)
|
51
51
|
RUBY
|
52
|
+
|
53
|
+
Opal.compile(script).strip.chomp(';')
|
52
54
|
end
|
53
55
|
|
54
56
|
def self.prerender_script(layout, application, application_id, javascript_include_tags: '', **needs)
|