Class: Jshint::Configuration
- Inherits:
-
Object
- Object
- Jshint::Configuration
- Defined in:
- lib/jshint/configuration.rb
Overview
Configuration object containing JSHint lint settings
Instance Attribute Summary collapse
-
#options ⇒ Hash
readonly
The configration options.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Returns the value of the options Hash if one exists.
- #default_search_paths ⇒ Object
- #excluded_search_paths ⇒ Object
-
#files ⇒ Array<String>
Returns the list of files that JSHint should lint over relatives to the Application root.
-
#global_variables ⇒ Hash?
Returns a Hash of global variables if one exists.
- #included_search_paths ⇒ Object
-
#initialize(path = nil) ⇒ Configuration
constructor
Initializes our configuration object.
-
#lint_options ⇒ Hash?
Returns a Hash of options to be used by JSHint.
- #search_paths ⇒ Object
Constructor Details
#initialize(path = nil) ⇒ Configuration
Initializes our configuration object
13 14 15 16 |
# File 'lib/jshint/configuration.rb', line 13 def initialize(path = nil) @path = path || default_config_path @options = parse_yaml_config end |
Instance Attribute Details
#options ⇒ Hash (readonly)
Returns the configration options.
8 9 10 |
# File 'lib/jshint/configuration.rb', line 8 def @options end |
Instance Method Details
#[](key) ⇒ Object
Returns the value of the options Hash if one exists
22 23 24 |
# File 'lib/jshint/configuration.rb', line 22 def [](key) ["options"][key.to_s] end |
#default_search_paths ⇒ Object
79 80 81 82 83 84 85 |
# File 'lib/jshint/configuration.rb', line 79 def default_search_paths [ 'app/assets/javascripts', 'vendor/assets/javascripts', 'lib/assets/javascripts' ] end |
#excluded_search_paths ⇒ Object
67 68 69 |
# File 'lib/jshint/configuration.rb', line 67 def excluded_search_paths .fetch("exclude_paths", []) end |
#files ⇒ Array<String>
Returns the list of files that JSHint should lint over relatives to the Application root
63 64 65 |
# File 'lib/jshint/configuration.rb', line 63 def files ["files"] end |
#global_variables ⇒ Hash?
Returns a Hash of global variables if one exists
36 37 38 |
# File 'lib/jshint/configuration.rb', line 36 def global_variables ["options"]["globals"] end |
#included_search_paths ⇒ Object
71 72 73 |
# File 'lib/jshint/configuration.rb', line 71 def included_search_paths .fetch("include_paths", []) end |
#lint_options ⇒ Hash?
Returns a Hash of options to be used by JSHint
See jshint.com/docs/options/ for more config options
50 51 52 |
# File 'lib/jshint/configuration.rb', line 50 def @lint_options ||= ["options"].reject { |key| key == "globals" } end |
#search_paths ⇒ Object
75 76 77 |
# File 'lib/jshint/configuration.rb', line 75 def search_paths (default_search_paths + included_search_paths) - excluded_search_paths end |