Sha256: 78ec70dc5b2cea9694d6656636289b600fde8e3a332856ae12d21db904d555c3
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
module SlimGruntHelpers module Models class Usemin BASE_OPTIONS = {}.freeze def initialize @links = [] end def <<(path, options={}) @links << { path: path.to_s, options: base_options.merge(options) } end alias_method :add, :<< alias_method :include, :<< def require(path, options={}) self.include(path, options) unless @links.include? path.to_s end def each @links.each { |link| yield(transform_link(link)) } end def base_options BASE_OPTIONS end def require_tree(root_path, pattern, options={}) Dir[root_path.join(pattern)].reject do |file| File.directory? file end.each do |file| file_name = file.to_s file_name["#{ root_path }/"] = '' self.require file_name, options end end protected def transform_link(link) raise NotImplementedError, 'This method must be implemented in child classes' end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
slim-grunt-helpers-0.1.0 | lib/slim-grunt-helpers/models/usemin.rb |