Class: Querly::ScriptEnumerator
- Inherits:
- 
      Object
      
        - Object
- Querly::ScriptEnumerator
 
- Defined in:
- lib/querly/script_enumerator.rb
Defined Under Namespace
Classes: Builder
Instance Attribute Summary collapse
- 
  
    
      #config  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute config. 
- 
  
    
      #paths  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute paths. 
Class Method Summary collapse
Instance Method Summary collapse
- #each(&block) ⇒ Object
- 
  
    
      #initialize(paths:, config:)  ⇒ ScriptEnumerator 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of ScriptEnumerator. 
Constructor Details
#initialize(paths:, config:) ⇒ ScriptEnumerator
Returns a new instance of ScriptEnumerator.
| 6 7 8 9 | # File 'lib/querly/script_enumerator.rb', line 6 def initialize(paths:, config:) @paths = paths @config = config end | 
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
| 4 5 6 | # File 'lib/querly/script_enumerator.rb', line 4 def config @config end | 
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
| 3 4 5 | # File 'lib/querly/script_enumerator.rb', line 3 def paths @paths end | 
Class Method Details
.find_loader(path) ⇒ Object
| 31 32 33 34 | # File 'lib/querly/script_enumerator.rb', line 31 def self.find_loader(path) basename = path.basename.to_s @loaders.find {|pair| pair.first === basename }&.last end | 
.register_loader(pattern, loader) ⇒ Object
| 27 28 29 | # File 'lib/querly/script_enumerator.rb', line 27 def self.register_loader(pattern, loader) @loaders << [pattern, loader] end | 
Instance Method Details
#each(&block) ⇒ Object
| 11 12 13 14 15 16 17 18 19 20 21 22 23 | # File 'lib/querly/script_enumerator.rb', line 11 def each(&block) if block_given? paths.each do |path| if path.directory? enumerate_files_in_dir(path, &block) else load_script_from_path path, &block end end else self.enum_for :each end end |