Sha256: d4b233c7901b08d4a5dc2f6aadfb4b79f27dd8292c1d18fd881ba7eba834c3b9

Contents?: true

Size: 594 Bytes

Versions: 1

Compression:

Stored size: 594 Bytes

Contents

module TemplateManager
  extend self

  def outer_templates
    templates.keys
  end
  def inner_templates(outer)
    templates[outer].keys
  end
  def inner_template(outer, name)
    templates[outer][name]
  end
private
  def templates
    Dir.chdir(TEMPLATE_PATH) do
      @templates ||= Dir.entries(".").inject({}) do |templates, entry|
        yml_path = File.join(entry, "template.yml")
        if entry != '.' && 
           entry != '..' && 
           File.exists?(yml_path)
          templates[entry] = YAML.load_file(yml_path)
        end
        templates
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fassets_core-0.2.0 lib/template_manager.rb