Sha256: a1e5d6a6b1a880bdaa5a3a5ac25a0d401e374d2b5685befa45a08fb39a2954b4
Contents?: true
Size: 1.5 KB
Versions: 2
Compression:
Stored size: 1.5 KB
Contents
class File # Converts the given `file_name` into its absolute path. The current working # directory is used as the reference unless the `dir_string` is given, in # which case that is used. # # @param [String] file_name # @param [String] dir_string # @return [String] def self.expand_path(file_name, dir_string = nil) if dir_string `return Op.fs.expand_path(file_name, dir_string);` else `return Op.fs.expand_path(file_name);` end end # Returns a new string constructed by joining the given args with the default # file separator. # # @param [String] str # @return [String] def self.join(*str) `return Op.fs.join.apply(Op.fs, str);` end # Returns all the components of the given `file_name` except for the last # one. # # @param [String] file_name # @return [String] def self.dirname(file_name) `return Op.fs.dirname(file_name);` end # Returns the extension of the given filename. # # @param [String] file_name # @return [String] def self.extname(file_name) `return Op.fs.extname(file_name);` end # Returns the last path component of the given `file_name`. If a suffix is # given, and is present in the path, then it is removed. This is useful for # removing file extensions, for example. # # @param [String] file_name # @param [String] suffix # @return [String] def self.basename(file_name, suffix) `return Op.fs.basename(file_name, suffix);` end def self.exist?(path) `return Op.fs.exist_p(path);` end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
opal-0.3.10 | corelib/file.rb |
opal-0.3.9 | corelib/file.rb |