lowload 0.4.0 → 0.5.0
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/lowload.rb +7 -7
- data/lib/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ff485e94bc43e900c70c84618b8291a7f329f65f5c77f800e4f63441abea255a
|
|
4
|
+
data.tar.gz: a0791c307b326183ad64da9a094e2591e368edd1871b075eff8432cef79a8467
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3a91ef3b898d28435381872dfe19589699ab7fe396969780001d4c5d27e144518cd3cb5eb9165ebb3e46c5149a28fd2d511b698f3beb760e95d58fe45a0b0ef9
|
|
7
|
+
data.tar.gz: fee30da0af61c8160415a6017a9baac910fb529ecb66239b4198c1a068d58054372e8fb00df64823cd6b4a335c4754919fda61a3316b9a471ea26b6ac301ea4c
|
data/lib/lowload.rb
CHANGED
|
@@ -10,6 +10,8 @@ def top_level_binding
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
module LowLoad
|
|
13
|
+
class UnsupportedTemplate < StandardError; end
|
|
14
|
+
|
|
13
15
|
class << self
|
|
14
16
|
# Files are mapped, autoloaded, then loaded into Ruby in 3 separate stages.
|
|
15
17
|
def dirload(path, pwd = Dir.pwd)
|
|
@@ -58,18 +60,18 @@ module LowLoad
|
|
|
58
60
|
templates.each do |namespace, method_template|
|
|
59
61
|
klass = const_get(namespace)
|
|
60
62
|
method, template = method_template
|
|
61
|
-
# TODO: If params contain "**props" or similar then send that so that
|
|
63
|
+
# TODO: If params contain "**props" or similar then send that, so that LowNode can replicate it.
|
|
62
64
|
params = method.params.map(&:name)
|
|
63
65
|
|
|
64
|
-
next unless supports_templates?(klass)
|
|
66
|
+
next unless supports_templates?(klass) || raise(UnsupportedTemplate, "Template for '#{namespace}' identified but not implemented")
|
|
65
67
|
|
|
66
68
|
# TODO: Make template engine configurable.
|
|
67
|
-
klass.
|
|
69
|
+
klass.build_template(template:, params:, engine: Antlers, namespace:)
|
|
68
70
|
end
|
|
69
71
|
end
|
|
70
72
|
|
|
71
73
|
def supports_templates?(klass)
|
|
72
|
-
klass.respond_to?(:render) && klass.respond_to?(:template) && klass.respond_to?(:
|
|
74
|
+
klass.respond_to?(:render) && klass.respond_to?(:template) && klass.respond_to?(:build_template)
|
|
73
75
|
end
|
|
74
76
|
|
|
75
77
|
def wrap_render_methods(file_proxy:)
|
|
@@ -88,9 +90,7 @@ module LowLoad
|
|
|
88
90
|
end
|
|
89
91
|
|
|
90
92
|
# Intended to target HTML or Antlers tags. Use HEREDOC "<<~" in a plain Ruby (".rb") file, not RBX.
|
|
91
|
-
if render_method_body.strip.start_with?('<')
|
|
92
|
-
render_method.body.wrap(prefix: '%q{', suffix: '}')
|
|
93
|
-
end
|
|
93
|
+
render_method.body.wrap(prefix: '%q{', suffix: '}') if render_method_body.strip.start_with?('<')
|
|
94
94
|
end
|
|
95
95
|
|
|
96
96
|
templates
|
data/lib/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lowload
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- maedi
|
|
@@ -23,8 +23,8 @@ dependencies:
|
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: '0'
|
|
26
|
-
description: An autoloader that lets you use any module namespace
|
|
27
|
-
|
|
26
|
+
description: An autoloader that lets you use any module namespace with any folder
|
|
27
|
+
structure and mix in manual requires.
|
|
28
28
|
email:
|
|
29
29
|
- maediprichard@gmail.com
|
|
30
30
|
executables: []
|
|
@@ -53,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
55
|
requirements: []
|
|
56
|
-
rubygems_version:
|
|
56
|
+
rubygems_version: 4.0.10
|
|
57
57
|
specification_version: 4
|
|
58
|
-
summary: An autoloader
|
|
58
|
+
summary: An autoloader without namespace and folder structure conventions
|
|
59
59
|
test_files: []
|