From 4ea80a9476c2f40f9f9271982199f95b8d28eb98 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Thu, 2 May 2024 10:18:21 -0300 Subject: [PATCH] Add RequireRules docs --- nanoc/ruledsl/require_rules.rb | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/nanoc/ruledsl/require_rules.rb b/nanoc/ruledsl/require_rules.rb index 171b59f..f82965a 100644 --- a/nanoc/ruledsl/require_rules.rb +++ b/nanoc/ruledsl/require_rules.rb @@ -1,8 +1,22 @@ module Nanoc::RuleDSL module RequireRules - def require_rules(rules, locals = {}, target = binding) + ## + # @example + # require_rules "nanoc/rules/assets" + # + # @param [String] path + # The path to a file + # + # @param [Hash] locals + # A hash of locals + # + # @param [Binding] target + # Binding context + # + # @return [void] + def require_rules(path, locals = {}, target = binding) locals.each { target.local_variable_set(_1, _2) } - path = File.join(Dir.getwd, rules) + path = File.join(Dir.getwd, path) target.eval( if File.readable?(path) File.read(path)