vido 1.0.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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/vido.rb +53 -0
  3. metadata +44 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4037c34010ab3bf46b302804469a7d30ad356057d18f9274421e3df56620f144
4
+ data.tar.gz: ef8277b6a8ca5043cee481079c6537e0fb6f7838f3bc6841946a2b310c3b9a55
5
+ SHA512:
6
+ metadata.gz: be919a6875cd702f1326e9e274959f8d937c67f07e92d1186b7589ce0a500926a136b6c741c22b924974351f55a8ad6bdf856d8f28582fd5d9e871bc97716f1e
7
+ data.tar.gz: 3d30fdcd30f8bdafb3ff39c3b763aa82d432102d8e0589fae08353b86a08b241c646a8ed6b1618116ff24b5bdf8a0ac9cb26bb2b3b4910fa373c96de741d633c
@@ -0,0 +1,53 @@
1
+ ##
2
+ # vido gem. A simple ERB wrapper
3
+ #
4
+ # Copyright (C) 2018 Juanma Cabello
5
+ #
6
+ # This program is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
18
+ require 'erb'
19
+
20
+ ##
21
+ # The main Vido class
22
+ class Vido
23
+ ##
24
+ # Class initializer
25
+ #
26
+ # Arguments:
27
+ # layout: (String)
28
+ # template: (String)
29
+ def initialize(layout, template)
30
+ @layout = File.read(layout)
31
+ @template = File.read(template)
32
+ end
33
+
34
+ ##
35
+ # Performs the rendering process
36
+ def render
37
+ templates = [@template, @layout]
38
+ templates.inject(nil) do |prev, temp|
39
+ _render(temp) { prev }
40
+ end
41
+ end
42
+
43
+ private
44
+
45
+ ##
46
+ # Use ERB to render the template
47
+ #
48
+ # Arguments:
49
+ # temp: (File)
50
+ def _render(temp)
51
+ ERB.new(temp, nil, '>').result(binding)
52
+ end
53
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vido
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Juanma Cabello
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-08-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Envoltorio de ERB que permite crear rápidamente vistas
14
+ email: kerunaru@icloud.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/vido.rb
20
+ homepage: https://gitlab.com/kerunaru/vido
21
+ licenses:
22
+ - GPL3
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.7.6
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Gema para creación rápida de vistas
44
+ test_files: []