Class: Fluoride::Analyzer::Config
- Inherits:
-
Object
- Object
- Fluoride::Analyzer::Config
- Defined in:
- lib/fluoride-analyzer/config.rb
Constant Summary collapse
- DEFAULT_CONFIG_PATH =
'.fluoride.yml'
- DEFAULT_EXCLUDE_PATHS =
[ %r[^/images], %r[^/stylesheets], %r[^/javascripts], %r[^/system], ]
- DEFAULT_EXCLUDE_MIME_TYPES =
[ %r[image], %r[text/css], %r[javascript], %r[shockwave] ]
Instance Attribute Summary collapse
-
#exclude_match_params ⇒ Object
Returns the value of attribute exclude_match_params.
-
#exclude_mime_types ⇒ Object
Returns the value of attribute exclude_mime_types.
-
#exclude_path_patterns ⇒ Object
Returns the value of attribute exclude_path_patterns.
-
#limit_count ⇒ Object
Returns the value of attribute limit_count.
-
#match_on_required_params ⇒ Object
Returns the value of attribute match_on_required_params.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(yaml_config) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(yaml_config) ⇒ Config
Returns a new instance of Config.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/fluoride-analyzer/config.rb', line 21 def initialize(yaml_config) self.exclude_path_patterns = DEFAULT_EXCLUDE_PATHS + yaml_config['exclude_path_patterns'] - yaml_config['include_path_patterns'] self.exclude_mime_types = DEFAULT_EXCLUDE_MIME_TYPES + yaml_config['exclude_mime_types'] - yaml_config['include_mime_types'] if yaml_config.has_key?('match_on_required_params') self.match_on_required_params = yaml_config['match_on_required_params'] else self.match_on_required_params = false end self.exclude_match_params = yaml_config['exclude_match_params'] || [] self.include_match_params = yaml_config['include_match_params'] || [] self.limit_count = yaml_config['limit_count'] end |
Instance Attribute Details
#exclude_match_params ⇒ Object
Returns the value of attribute exclude_match_params.
9 10 11 |
# File 'lib/fluoride-analyzer/config.rb', line 9 def exclude_match_params @exclude_match_params end |
#exclude_mime_types ⇒ Object
Returns the value of attribute exclude_mime_types.
9 10 11 |
# File 'lib/fluoride-analyzer/config.rb', line 9 def exclude_mime_types @exclude_mime_types end |
#exclude_path_patterns ⇒ Object
Returns the value of attribute exclude_path_patterns.
9 10 11 |
# File 'lib/fluoride-analyzer/config.rb', line 9 def exclude_path_patterns @exclude_path_patterns end |
#limit_count ⇒ Object
Returns the value of attribute limit_count.
9 10 11 |
# File 'lib/fluoride-analyzer/config.rb', line 9 def limit_count @limit_count end |
#match_on_required_params ⇒ Object
Returns the value of attribute match_on_required_params.
9 10 11 |
# File 'lib/fluoride-analyzer/config.rb', line 9 def match_on_required_params @match_on_required_params end |
Class Method Details
.load(config_path = DEFAULT_CONFIG_PATH) ⇒ Object
16 17 18 19 |
# File 'lib/fluoride-analyzer/config.rb', line 16 def self.load(config_path = DEFAULT_CONFIG_PATH) yaml_config = YAML::load(File.open(config_path)) config = self.new(yaml_config) end |