class Cd::Examples::CrystalDir
- Cd::Examples::CrystalDir
 - Cd::DirEntry
 - Reference
 - Object
 
Overview
An example class  for EntryDir.dir and EntryDir.any.
class CrystalDir < Cd::EntryDir
  class SpecDir < Cd::EntryDir
    def files
      glob("**/*_spec.cr")
    end
  end
  dir "spec", SpecDir
  any "shard.yml"
  def shard
    YAML.parse(shard_yml.read)
  end
  def version
    shard["version"].to_s
  end
end
  Defined in:
examples/crystal_dir.crInstance Method Summary
- 
        #shard
        
          
Parses shard.yml and returns the result YAML::Any instance.
 - 
        #shard_yml : Cd::AnyEntry
        
          
Returns the "shard.yml" entry.
 - 
        #shard_yml? : Cd::AnyEntry | Nil
        
          
Returns the "shard.yml" entry if exists.
 - 
        #spec : SpecDir
        
          
Gets the "spec" directory.
 - 
        #spec(&block : SpecDir -> )
        
          
Changes the current directory into the "spec" directory.
 - 
        #version
        
          
Returns a version string given by shard.yml.
 
Instance methods inherited from class Cd::DirEntry
  
  
    
      [](*args)
    [], 
    
  
    
      []?(*args)
    []?, 
    
  
    
      cd(*args, &)
    cd, 
    
  
    
      cp(dst : String)cp(dst : Cd) cp, create create, dir(*args) dir, each(&) each, exists? exists?, glob(*patterns, &)
glob(*patterns) : Array(AnyEntry) glob, path : String path, remove(recursive = false) remove, tmp(*args, &)
tmp(*args) tmp
Class methods inherited from class Cd::DirEntry
  
  
    
      cd(*args, &)
    cd, 
    
  
    
      tmp(base = "/tmp", &)
    tmp
    
  
  
    
  Instance methods inherited from module Cd::AsAnyEntry
  
  
    
      append(text)
    append, 
    
  
    
      basedir
    basedir, 
    
  
    
      basename(suffix : String | Nil = nil)
    basename, 
    
  
    
      chmod(mode : Int)
    chmod, 
    
  
    
      cp(dst : String)cp(dst : AsAnyEntry) cp, directory?(*args) directory?, dirname dirname, executable?(*args) executable?, exists? exists?, file?(*args) file?, join(*args) join, read read, real_path real_path, remove remove, symlink? symlink?, to_dir to_dir, to_s(io : IO) to_s, touch(mode : Int | Nil = nil) touch, write(text, mode : Int | Nil = nil) write
Instance Method Detail
        
        def shard_yml : Cd::AnyEntry
        #
      
      
        Returns the "shard.yml" entry.
This method is automatically defined by the Cd library.
        
        def shard_yml? : Cd::AnyEntry | Nil
        #
      
      
        Returns the "shard.yml" entry if exists.
This method is automatically defined by the Cd library.
Gets the "spec" directory.
This method is automatically defined by the Cd library.
Changes the current directory into the "spec" directory.
This method is automatically defined by the Cd library.