rcurse 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6c5c9dd21efb2105ad884e0a4f6171b76a2f277b
4
+ data.tar.gz: f761340b02642a4ffadae61d0c17773b343f3fde
5
+ SHA512:
6
+ metadata.gz: 1cf1ee6bb1ecb7c260747a8be0491bed50bd9fbaa27532715b2b1be43277f11f400c49201d09c1e3640e9cc0bbf3a036758bf7bf017f7237bb64c24e4df13e40
7
+ data.tar.gz: bc37a1841b94a125b0ef9b4a22032185ba6485793e9433ecf39b8e89fce6a928b7b6cf52dbbd5d9604a4fb4668a88f7af0fbfd7187c729828552aa33e4dee44c
@@ -0,0 +1 @@
1
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1 @@
1
+ source 'https://rubygems.org'
@@ -0,0 +1,3 @@
1
+ # Rcurse <small>- Super simple template engine</small>
2
+
3
+ Currently WIP
@@ -0,0 +1,3 @@
1
+ require "rcurse/engine"
2
+ require "rcurse/helper"
3
+ require "rcurse/helpers/include"
@@ -0,0 +1,22 @@
1
+ module Rcurse
2
+ @helpers = Hash.new
3
+
4
+ def self.add_helper helper
5
+ @helpers[helper.name] = helper
6
+ end
7
+
8
+ def self.helpers
9
+ @helpers
10
+ end
11
+
12
+ def self.render filename
13
+ file_contents = File.read filename
14
+ file_contents.gsub /{{([^ ]+) *(.+)?}}/ do |s|
15
+ name = $1
16
+ args = $2.split(" ") if $2
17
+ if @helpers[name] then
18
+ @helpers[name].callback.call(args)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,13 @@
1
+ module Rcurse
2
+ class Helper
3
+ attr_accessor :name
4
+ attr_accessor :callback
5
+
6
+ def initialize name, &callback
7
+ @name = name
8
+ @callback = callback
9
+
10
+ Rcurse.add_helper self
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ Rcurse.add_helper Rcurse::Helper.new("include") do |args|
2
+ Rcurse::render args[0]
3
+ end
@@ -0,0 +1,11 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'rcurse'
3
+ s.version = '0.1.0'
4
+ s.licenses = ['MIT']
5
+ s.summary = "Super simple template engine."
6
+ s.description = "Super simple template engine."
7
+ s.authors = ["Nick Shvelidze"]
8
+ s.email = 'captain@pirrate.me'
9
+ s.files = `git ls-files`.split("\n")
10
+ s.homepage = 'http://shvelo.github.io/rcurse'
11
+ end
metadata ADDED
@@ -0,0 +1,51 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rcurse
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Nick Shvelidze
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-27 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Super simple template engine.
14
+ email: captain@pirrate.me
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - .gitignore
20
+ - Gemfile
21
+ - README.md
22
+ - lib/rcurse.rb
23
+ - lib/rcurse/engine.rb
24
+ - lib/rcurse/helper.rb
25
+ - lib/rcurse/helpers/include.rb
26
+ - rcurse.gemspec
27
+ homepage: http://shvelo.github.io/rcurse
28
+ licenses:
29
+ - MIT
30
+ metadata: {}
31
+ post_install_message:
32
+ rdoc_options: []
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ requirements: []
46
+ rubyforge_project:
47
+ rubygems_version: 2.1.11
48
+ signing_key:
49
+ specification_version: 4
50
+ summary: Super simple template engine.
51
+ test_files: []