Class: CodeFormatter::Configuration
- Inherits:
-
Object
- Object
- CodeFormatter::Configuration
- Defined in:
- lib/src/configuration.rb
Instance Attribute Summary collapse
-
#excluded_dirs ⇒ Object
Returns the value of attribute excluded_dirs.
-
#excluded_files ⇒ Object
Returns the value of attribute excluded_files.
-
#included_dirs ⇒ Object
Returns the value of attribute included_dirs.
-
#included_files ⇒ Object
Returns the value of attribute included_files.
-
#source_file ⇒ Object
readonly
Returns the value of attribute source_file.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize {|_self| ... } ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize {|_self| ... } ⇒ Configuration
Returns a new instance of Configuration.
10 11 12 13 14 15 16 17 |
# File 'lib/src/configuration.rb', line 10 def initialize self.included_files = [] self.excluded_files = [] self.included_dirs = [] self.excluded_dirs = [] yield self if block_given? end |
Instance Attribute Details
#excluded_dirs ⇒ Object
Returns the value of attribute excluded_dirs.
6 7 8 |
# File 'lib/src/configuration.rb', line 6 def excluded_dirs @excluded_dirs end |
#excluded_files ⇒ Object
Returns the value of attribute excluded_files.
4 5 6 |
# File 'lib/src/configuration.rb', line 4 def excluded_files @excluded_files end |
#included_dirs ⇒ Object
Returns the value of attribute included_dirs.
5 6 7 |
# File 'lib/src/configuration.rb', line 5 def included_dirs @included_dirs end |
#included_files ⇒ Object
Returns the value of attribute included_files.
3 4 5 |
# File 'lib/src/configuration.rb', line 3 def included_files @included_files end |
#source_file ⇒ Object
Returns the value of attribute source_file.
8 9 10 |
# File 'lib/src/configuration.rb', line 8 def source_file @source_file end |
Class Method Details
.load_from(file) ⇒ Configuration
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/src/configuration.rb', line 21 def self.load_from(file) return unless file || File.file?(file) begin config = eval(File.read(file), binding, 'config loading problem') config.source_file = file return config if config.is_a? Config warn "[#{file}] isn't a CodeFormatter::Configuration, but #{config.class}." rescue SyntaxError, StandardError => e warn "Invalid configuration in [#{file}]: #{e}" end end |