Class: JSHint4r::Config
- Inherits:
-
Object
- Object
- JSHint4r::Config
- Defined in:
- lib/jshint4r/config.rb
Instance Attribute Summary collapse
-
#excludes ⇒ Object
Returns the value of attribute excludes.
-
#opts ⇒ Object
Returns the value of attribute opts.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#reporter ⇒ Object
Returns the value of attribute reporter.
-
#targets ⇒ Object
Returns the value of attribute targets.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
-
#initialize(path = nil) ⇒ Config
constructor
A new instance of Config.
-
#read_config_file(path) ⇒ Object
- param
-
String path [return] Boolean.
Constructor Details
#initialize(path = nil) ⇒ Config
Returns a new instance of Config.
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/jshint4r/config.rb', line 3 def initialize( path = nil ) @excludes = [] @opts = {} @path = nil @reporter = :text @targets = [] @verbose = false if path and read_config_file( path ) @path = path end end |
Instance Attribute Details
#excludes ⇒ Object
Returns the value of attribute excludes.
15 16 17 |
# File 'lib/jshint4r/config.rb', line 15 def excludes @excludes end |
#opts ⇒ Object
Returns the value of attribute opts.
15 16 17 |
# File 'lib/jshint4r/config.rb', line 15 def opts @opts end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
15 16 17 |
# File 'lib/jshint4r/config.rb', line 15 def path @path end |
#reporter ⇒ Object
Returns the value of attribute reporter.
16 17 18 |
# File 'lib/jshint4r/config.rb', line 16 def reporter @reporter end |
#targets ⇒ Object
Returns the value of attribute targets.
15 16 17 |
# File 'lib/jshint4r/config.rb', line 15 def targets @targets end |
#verbose ⇒ Object
Returns the value of attribute verbose.
16 17 18 |
# File 'lib/jshint4r/config.rb', line 16 def verbose @verbose end |
Instance Method Details
#read_config_file(path) ⇒ Object
- param
-
String path
- return
-
Boolean
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/jshint4r/config.rb', line 22 def read_config_file( path ) r = false if File.exist?( path ) conf = YAML.load_file( path ) if ( conf.is_a? Hash ) self.excludes = conf['excludes'] if conf.has_key? 'excludes' self.opts = conf['options'] if conf.has_key? 'options' self.reporter = conf['reporter'] if conf.has_key? 'reporter' self.targets = conf['src'] if conf.has_key? 'src' self.verbose = conf['verbose'] if conf.has_key? 'verbose' r = true end end return r end |