Module: Templator::Actions
- Defined in:
- lib/templator/actions.rb
Instance Method Summary collapse
Instance Method Details
#include_file(filename) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/templator/actions.rb', line 25 def include_file(filename) content="" catch(:file_found) do search_path.each do |dir| path = File.join(dir, filename) if File.exist?(path) content = ERB.new(::File.read(path), nil, '-', 'included_template').result(binding) throw :file_found end end end return content end |
#param(name) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/templator/actions.rb', line 8 def param(name) begin parameters.get(name) rescue NoMethodError => e parameters.get("#{context}.#{name}") end end |
#param_exists?(name) ⇒ Boolean
16 17 18 19 20 21 22 23 |
# File 'lib/templator/actions.rb', line 16 def param_exists?(name) begin param(name) true rescue false end end |