class CodeFormatter::Configuration

Attributes

excluded_dirs[RW]
excluded_files[RW]
included_dirs[RW]
included_files[RW]
source_file[R]

Public Class Methods

load_from(file) click to toggle source

@param [String] file @return [Configuration]

# 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
new() { |self| ... } click to toggle source
# 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

Private Instance Methods

source_file=(file) click to toggle source
# File lib/src/configuration.rb, line 37
def source_file=(file)
  return unless file || File.file?(file)
  @source_file = file
end