Class: Spellcop::FolderChecker
- Inherits:
-
Object
- Object
- Spellcop::FolderChecker
- Defined in:
- lib/spellcop/folder_checker.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
- #check! ⇒ Object
-
#initialize(foldername, recursive = true) ⇒ FolderChecker
constructor
A new instance of FolderChecker.
Constructor Details
#initialize(foldername, recursive = true) ⇒ FolderChecker
Returns a new instance of FolderChecker.
5 6 7 8 9 10 11 12 13 |
# File 'lib/spellcop/folder_checker.rb', line 5 def initialize(foldername, recursive = true) @warnings = [] if recursive @folder = "#{foldername}/**/*.rb" else @folder = "#{foldername}/*.rb" end @files = [] end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
3 4 5 |
# File 'lib/spellcop/folder_checker.rb', line 3 def files @files end |
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings.
3 4 5 |
# File 'lib/spellcop/folder_checker.rb', line 3 def warnings @warnings end |
Instance Method Details
#check! ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/spellcop/folder_checker.rb', line 15 def check! Dir[@folder].each do |file| result = { file: file, warnings: FileChecker.new(file).check! } @warnings << result unless result[:warnings].empty? @files << file end @warnings end |