Module: Liquor::Library::ModuleMethods
- Defined in:
- lib/liquor/library.rb
Instance Method Summary collapse
- #export(compiler) ⇒ Object
- #function(name, options = {}, &block) ⇒ Object
- #function_alias(name, other) ⇒ Object
- #tag(name, options = {}, &block) ⇒ Object
Instance Method Details
#export(compiler) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/liquor/library.rb', line 13 def export(compiler) @functions.each do |function| compiler.register_function function end @tags.each do |tag| compiler.register_tag tag end end |
#function(name, options = {}, &block) ⇒ Object
23 24 25 |
# File 'lib/liquor/library.rb', line 23 def function(name, ={}, &block) @functions << Function.new(name, , &block) end |
#function_alias(name, other) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/liquor/library.rb', line 27 def function_alias(name, other) function = @functions.find { |f| f.name == other } if function.nil? raise "Cannot alias to function `#{other}', as it does not exist" end @functions << function.alias(name) end |