erb_component 0.1.4 → 0.1.5
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/erb_component/erb_component.rb +17 -6
- data/lib/erb_component/version.rb +1 -1
- 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: 9e48ccbfc0ce46abcce8ecedab8dd8b56e64254b242ba52e919429c4aba0e362
|
4
|
+
data.tar.gz: c976659b689ad129f06160d1423af4f4ad168209af878c81cf647f4c0257b9b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df51f06dd8f67c0dbeacbee4267de9107268b29b4b7bfbedaae273774924940d5c3f5de767e8c31e9fa2f6157a0d5dae80e363ca9cabaff62dbeaabbc233b190
|
7
|
+
data.tar.gz: 0b54f5577b6ee16e915dd33cd0931d950bd8726a59091c0e2dc471cc327b3af4df4eb3f88fe968a6ad61c32ca9467e4b7dabbd492f3a9c93255d74ca185d03d9
|
@@ -29,13 +29,24 @@ class ErbComponent
|
|
29
29
|
new(opts).render
|
30
30
|
end
|
31
31
|
|
32
|
+
def template_file_path
|
33
|
+
@template_file_path ||= begin
|
34
|
+
file_name = "#{self.class.name.underscore}.erb"
|
35
|
+
if File.exists? "components/#{file_name}"
|
36
|
+
return "components/#{file_name}"
|
37
|
+
elsif File.exists? "pages/#{file_name}"
|
38
|
+
return "pages/#{file_name}"
|
39
|
+
else
|
40
|
+
nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
32
45
|
def template
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
return File.read a if File.exists? a
|
38
|
-
fail "not found: #{file_name}"
|
46
|
+
if template_file_path
|
47
|
+
File.read template_file_path
|
48
|
+
end
|
49
|
+
fail "not found: #{template_file_path}"
|
39
50
|
end
|
40
51
|
|
41
52
|
def method_missing(m, *args, &block)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: erb_component
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arthur Karganyan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: React-style front-end components but for ERB?
|
14
14
|
email:
|