Tangerine::FileLib (Class)

In: tangerine.rb
Parent: Object

Resolve tags by finding files in the FileLib’s search path.

Typical usage:

  filelib = Tangerine::FileLib.new("/my/tags", "/my/other/tags")
  template = Tangerine.new File.read("/my/template", filelib)

Methods

new   resolve  

Public Class methods

Instantiate a new FileLib using searchpath to lookup files.

[Source]

     # File tangerine.rb, line 297
297:     def initialize(*searchpath)
298:       @searchpath = searchpath
299:     end

Public Instance methods

[Source]

     # File tangerine.rb, line 301
301:     def resolve(tag)
302:       if dir = @searchpath.find { |dir| File.exist? File.join(dir, tag) }
303:         File.read(File.join(dir, tag)).gsub(/\n\Z/, '')
304:       else
305:         raise "Tag not resolvable: #{tag}"
306:       end
307:     end

[Validate]