Class: Confinement::Config

Inherits:
Object
  • Object
show all
Extended by:
BuilderGetterInitialization
Defined in:
lib/confinement.rb

Defined Under Namespace

Classes: Compiler, Source, WatcherPaths, ZeitwerkProxy

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from BuilderGetterInitialization

builder_getter

Constructor Details

#initialize(root:) ⇒ Config

Returns a new instance of Config.



124
125
126
127
128
129
130
# File 'lib/confinement.rb', line 124

def initialize(root:)
  @root = Pathname.new(root).expand_path.cleanpath

  if !@root.exist?
    raise Error::PathDoesNotExist, "Root path does not exist: #{@root}"
  end
end

Instance Attribute Details

#loggerObject



135
136
137
# File 'lib/confinement.rb', line 135

def logger
  @logger ||= default_logger
end

#rootObject (readonly)

Returns the value of attribute root.



132
133
134
# File 'lib/confinement.rb', line 132

def root
  @root
end

Instance Method Details

#default_loggerObject



139
140
141
142
143
# File 'lib/confinement.rb', line 139

def default_logger
  Logger.new($stdout).tap do |l|
    l.level = Logger::INFO
  end
end