Class: Dressmaker::Configuration
- Inherits:
-
Object
- Object
- Dressmaker::Configuration
- Defined in:
- lib/dressmaker/configuration.rb,
lib/dressmaker/configuration/rule.rb,
lib/dressmaker/configuration/matcher.rb,
lib/dressmaker/configuration/file_rule.rb,
lib/dressmaker/configuration/delegators.rb,
lib/dressmaker/configuration/file_matcher.rb,
lib/dressmaker/configuration/directory_rule.rb,
lib/dressmaker/configuration/directory_matcher.rb
Defined Under Namespace
Classes: Delegators, DirectoryMatcher, DirectoryRule, FileMatcher, FileRule, Matcher, Rule
Instance Attribute Summary collapse
-
#description_holder ⇒ Object
Returns the value of attribute description_holder.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
Class Method Summary collapse
Instance Method Summary collapse
- #directory ⇒ Object
- #files ⇒ Object
-
#initialize(options) ⇒ Configuration
constructor
A new instance of Configuration.
- #process!(target) ⇒ Object
Constructor Details
#initialize(options) ⇒ Configuration
Returns a new instance of Configuration.
21 22 23 24 |
# File 'lib/dressmaker/configuration.rb', line 21 def initialize() @options = @rules = [] end |
Instance Attribute Details
#description_holder ⇒ Object
Returns the value of attribute description_holder.
12 13 14 |
# File 'lib/dressmaker/configuration.rb', line 12 def description_holder @description_holder end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
13 14 15 |
# File 'lib/dressmaker/configuration.rb', line 13 def @options end |
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
13 14 15 |
# File 'lib/dressmaker/configuration.rb', line 13 def rules @rules end |
Class Method Details
.load(file, options) ⇒ Object
15 16 17 18 19 |
# File 'lib/dressmaker/configuration.rb', line 15 def self.load(file, ) configuration = new() configuration.instance_eval(File.read(file)) configuration end |
Instance Method Details
#directory ⇒ Object
26 27 28 |
# File 'lib/dressmaker/configuration.rb', line 26 def directory DirectoryMatcher.new(self) end |
#files ⇒ Object
30 31 32 |
# File 'lib/dressmaker/configuration.rb', line 30 def files FileMatcher.new(self) end |
#process!(target) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/dressmaker/configuration.rb', line 34 def process!(target) rules.each do |rule| Dir.glob("#{target}/**/*") do |file| rel_file = file[target.size, file.size] rule.inform && rule.execute!(file) if rule.matches?(target, rel_file) end end end |