Class: PhpCop::ConfigStore

Inherits:
Object
  • Object
show all
Defined in:
lib/phpcop/configstore.rb

Overview

Store configuration of gems. Parse config file and test if option is enabled

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfigStore

Returns a new instance of ConfigStore.



10
11
12
13
14
15
16
17
18
# File 'lib/phpcop/configstore.rb', line 10

def initialize
  opt = ConfigLoader.new
  @options = opt.options
  @rules = []

  @options.fetch('AllCops').each do |val|
    @rules.push PhpCop::Rule.new(val[0], val[1])
  end
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



8
9
10
# File 'lib/phpcop/configstore.rb', line 8

def options
  @options
end

#rulesObject (readonly)

Returns the value of attribute rules.



8
9
10
# File 'lib/phpcop/configstore.rb', line 8

def rules
  @rules
end

Instance Method Details

#rules_by_type(type) ⇒ Object



20
21
22
# File 'lib/phpcop/configstore.rb', line 20

def rules_by_type(type)
  @rules.select { |rule| rule.type.eql? type }
end