Class: PhpCop::ConfigStore
- Inherits:
-
Object
- Object
- PhpCop::ConfigStore
- Defined in:
- lib/phpcop/configstore.rb
Overview
Store configuration of gems. Parse config file and test if option is enabled
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
Instance Method Summary collapse
-
#initialize ⇒ ConfigStore
constructor
A new instance of ConfigStore.
- #rules_by_type(type) ⇒ Object
Constructor Details
#initialize ⇒ ConfigStore
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. @rules = [] @options.fetch('AllCops').each do |val| @rules.push PhpCop::Rule.new(val[0], val[1]) end end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/phpcop/configstore.rb', line 8 def @options end |
#rules ⇒ Object (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 |