class Motion::Project::XFiles
Constants
- TEMPLATES
Public Class Methods
new(config)
click to toggle source
# File lib/project/x_files.rb, line 17 def initialize(config) @config = config @excluded_templates = (TEMPLATES - [@config.template]).map(&:to_s) end
Public Instance Methods
filter!()
click to toggle source
# File lib/project/x_files.rb, line 22 def filter! @config.files.each do |file| if exclude?(file) @config.files.delete(file) end end end
Private Instance Methods
exclude?(file)
click to toggle source
# File lib/project/x_files.rb, line 32 def exclude?(file) @excluded_templates.any? do |template| file_matches_template?(file, template) end end
file_matches_template?(file, template)
click to toggle source
# File lib/project/x_files.rb, line 38 def file_matches_template?(file, template) file.match(/\/#{template}\//) || file.match(/#{template}.rb$/) end