Sha256: 639159323365eedaf54d89039df87f5e8455a53faac36967f54ea355f6cd468d

Contents?: true

Size: 1015 Bytes

Versions: 8

Compression:

Stored size: 1015 Bytes

Contents

module NanocFuel
  module Helpers

    # @author Arnau Siches
    #
    # @version 0.1.0
    # 
    # Provides some helper functions to process Rules.
    module RuleTemplates
      
      # Compiles the content as a set of Nanoc rules. Tries to use the 
      # +rules_dir+ attribute from the Config.yaml.
      # If +rules_dir+ is not defined, it uses +"."+ as a base path.
      # 
      # @example Config.yaml excerpt
      # 
      #   rules_dir: ['lib/rules/**', 'lib/other_rules']
      #
      # @example Rules excerpt
      # 
      #   # Finds any foo.rule in all directories defined in the Config.yaml
      #   load_rules('foo.rule')
      # 
      # @param [String] filepath The file path to load.
      # 
      # @return [Proc]
      def load_templates(templates)
        rule_template_path = 'rule_templates'
        templates.each do |template|
          instance_eval(File.read(File.expand_path("../#{rule_template_path}/#{template}", __FILE__)), template)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
nanoc-fuel-0.0.8 lib/nanoc-fuel/helpers/rule_templates.rb
nanoc-fuel-0.0.7 lib/nanoc-fuel/helpers/rule_templates.rb
nanoc-fuel-0.0.6 lib/nanoc-fuel/helpers/rule_templates.rb
nanoc-fuel-0.0.5 lib/nanoc-fuel/helpers/rule_templates.rb
nanoc_fuel-0.0.4 lib/nanoc_fuel/helpers/rule_templates.rb
nanoc_fuel-0.0.3 lib/nanoc_fuel/helpers/rule_templates.rb
nanoc_fuel-0.0.2 lib/nanoc_fuel/helpers/rule_templates.rb
nanoc_fuel-0.0.1 lib/nanoc_fuel/helpers/rule_templates.rb