aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2018-09-05 09:14:45 -0400
committerPaul Duncan <pabs@pablotron.org>2018-09-05 09:14:45 -0400
commitff3344c570a8200c2a5933ae6790e24611008bbf (patch)
tree4bd43345cb50e0567cc6ea7a0ac1809857b8d3df
parentf523b828d1612eb51fdd86b4179a40663ac6a0e6 (diff)
downloadluigi-template-ff3344c570a8200c2a5933ae6790e24611008bbf.tar.bz2
luigi-template-ff3344c570a8200c2a5933ae6790e24611008bbf.zip
ruby: add files to gemspec, ignore gemspec, add stub README.mkd
-rw-r--r--.gitignore1
-rw-r--r--ruby/README.mkd4
-rw-r--r--ruby/lib/luigi-template.rb56
-rw-r--r--ruby/luigi-template.gemspec7
4 files changed, 16 insertions, 52 deletions
diff --git a/.gitignore b/.gitignore
index ea93010..34ff2e6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
php/vendor
php/docs/
php/examples/*
+ruby/*.gem
diff --git a/ruby/README.mkd b/ruby/README.mkd
new file mode 100644
index 0000000..d08eff3
--- /dev/null
+++ b/ruby/README.mkd
@@ -0,0 +1,4 @@
+LuigiTemplate
+=============
+
+*TODO* populate.
diff --git a/ruby/lib/luigi-template.rb b/ruby/lib/luigi-template.rb
index 36faf74..8b0e553 100644
--- a/ruby/lib/luigi-template.rb
+++ b/ruby/lib/luigi-template.rb
@@ -4,18 +4,18 @@ module Luigi
#
# library version
#
- VERSION = '0.4.0'
+ VERSION = '0.4.2'
class LuigiError < Exception
end
class BaseUnknownError < LuigiError
- attr_reader :type_name,
+ attr_reader :type,
:name
- def initialize(type_name, name)
- @type_name, @name = type_name, name
- super("unknown #{type_name}: #{name}")
+ def initialize(type, name)
+ @type, @name = type, name
+ super("unknown #{type}: #{name}")
end
end
@@ -282,50 +282,4 @@ module Luigi
@templates[key].run(args)
end
end
-
- #
- # test module
- #
- module Test
- # test template
- TEMPLATE = '
- basic test: hello %{name}
- test filters: hello %{name | uc | base64 | hash sha1}
- test custom: hello %{name|custom}
- test custom_with_arg: %{name|custom_with_arg asdf}
- '
-
- CUSTOM_FILTERS = {
- custom: proc {
- 'custom'
- },
-
- custom_with_arg: proc { |v, args|
- args.first || 'custom'
- },
- }
-
- # test template cache
- CACHE = {
- test: TEMPLATE
- }
-
- # test arguments
- ARGS = {
- name: 'paul',
- }
-
- def self.run
- # add custom filters
- Luigi::FILTERS.update(CUSTOM_FILTERS)
-
- # test individual template
- puts Template.new(TEMPLATE).run(ARGS)
-
- # test template cache
- puts Cache.new(CACHE).run(:test, ARGS)
- end
- end
end
-
-Luigi::Test.run if __FILE__ == $0
diff --git a/ruby/luigi-template.gemspec b/ruby/luigi-template.gemspec
index 87ab75e..0bc63e5 100644
--- a/ruby/luigi-template.gemspec
+++ b/ruby/luigi-template.gemspec
@@ -8,7 +8,12 @@ Gem::Specification.new do |s|
s.description = 'Simple string templating library.'
s.authors = ['Paul Duncan']
s.email = 'pabs@pablotron.org'
- s.files = ["lib/luigi-template.rb"]
s.homepage = 'https://github.com/pablotron/luigi-template'
s.license = 'MIT'
+ s.files = %w{
+ README.mkd
+ Rakefile
+ test/test_template.rb
+ lib/luigi-template.rb
+ }
end