Class: Mokuji::Scanner
- Inherits:
-
Object
- Object
- Mokuji::Scanner
- Includes:
- Validators
- Defined in:
- lib/mokuji/scanner.rb
Overview
{ SCANNER }
Info
Lists the directory contents in nested hashes / arrays Dot files are hidden by default
Output example : Hash
example =
type: 'directory'
name: 'I am an example'
contents: [ directory_hash, file_hash, file_hash ]
How to use
scanner = Mokuji::Scanner.new scanner_results = scanner.scan ‘/usr/local/Cellar/’
Instance Attribute Summary collapse
-
#path_to_scan ⇒ Object
readonly
Returns the value of attribute path_to_scan.
Instance Method Summary collapse
-
#initialize ⇒ Scanner
constructor
A new instance of Scanner.
- #scan(path) ⇒ Object
Methods included from Validators
#json_valid?, #validate_configuration, #validate_data_from_converter, #validate_data_from_scanner, #validate_export_path, #validate_import_path, validate_options
Constructor Details
#initialize ⇒ Scanner
Returns a new instance of Scanner.
30 31 32 |
# File 'lib/mokuji/scanner.rb', line 30 def initialize validate_configuration end |
Instance Attribute Details
#path_to_scan ⇒ Object (readonly)
Returns the value of attribute path_to_scan.
28 29 30 |
# File 'lib/mokuji/scanner.rb', line 28 def path_to_scan @path_to_scan end |
Instance Method Details
#scan(path) ⇒ Object
34 35 36 37 38 |
# File 'lib/mokuji/scanner.rb', line 34 def scan path validate_import_path path @path_to_scan = path return make_collection end |