diff options
Diffstat (limited to 'ruby')
-rw-r--r-- | ruby/README.mkd | 4 | ||||
-rw-r--r-- | ruby/lib/luigi-template.rb | 56 | ||||
-rw-r--r-- | ruby/luigi-template.gemspec | 7 |
3 files changed, 15 insertions, 52 deletions
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 |