Class: Develry::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/develry/config.rb

Overview

Abstract base class of tool configuration

Direct Known Subclasses

Develry, Flay, Flog, Mutant, Reek, Rubocop, Yardstick

Defined Under Namespace

Classes: Develry, Flay, Flog, Mutant, Reek, Rubocop, Yardstick

Constant Summary collapse

DEFAULT_CONFIG =

Represent no configuration

{}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ Project

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize object



44
45
46
# File 'lib/develry/config.rb', line 44

def initialize(project)
  @project = project
end

Instance Attribute Details

#projectProject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return project

Returns:



36
37
38
# File 'lib/develry/config.rb', line 36

def project
  @project
end

Instance Method Details

#config_fileString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return config path

Returns:

  • (String)


54
55
56
# File 'lib/develry/config.rb', line 54

def config_file
  @config_file ||= project.config_dir.join(self.class::FILE).freeze
end

#enabled?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Test if the task is enabled

If there is no config file, and no sensible defaults, then the rake task should become disabled.

Returns:

  • (Boolean)


67
68
69
# File 'lib/develry/config.rb', line 67

def enabled?
  ! raw.equal?(DEFAULT_CONFIG)
end