Sha256: 09428815f3deea96b0dd909c434d3d1272883aa1f4460b402cdfe28e6ce1fa3d
Contents?: true
Size: 1.45 KB
Versions: 3
Compression:
Stored size: 1.45 KB
Contents
Directory = Dir class Directory { forwards_unary_ruby_methods metaclass forwards_unary_ruby_methods def self create: dirname { """ @dirname Path of @Directory@ to create. Creates a new @Directory@ on the filesystem, possibly throwing IOError Exceptions that might occur. """ try { Dir mkdir(dirname) } catch Errno::EEXIST => e { IOError new: (e message) . raise! } } def self create!: dirname { """ @dirname Path of @Directory@ to create. Creates a new @Directory@ on the filesystem, ignoring any Exceptions that might occur. Basically works like running `mkdir -p` on the shell. """ try { create: dirname } catch IOError { } } def self delete: dirname { """ @dirname Path to @Directory@ to delete. Deletes a directory with a given name, if it's empty. """ try { Dir delete(dirname) } catch StandardError => e { IOError new: (e message) . raise! } } def self list: pattern { """ @pattern Directory pattern or name containing files to be returned as an @Array@. @return @Array@ of files matching directory @pattern. Example: Directory list: \"tests/**/*.fy\" # => [\"tests/file1.fy\", \"tests/more/file2.fy\"] """ match pattern { case /\/$/ -> pattern = pattern + "*" case "." -> pattern = pattern + "/*" case ".." -> pattern = pattern + "/*" } Dir glob(pattern) } }
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fancy-0.10.0 | lib/rbx/directory.fy |
fancy-0.9.0 | lib/rbx/directory.fy |
fancy-0.8.0 | lib/rbx/directory.fy |