Class: Rant::SysObject
Overview
An instance of this class is returned from the sys
method in Rantfiles (when called without arguments).
sys.rm_rf "tmp"
In this (Rantfile) example, the rm_rf
message is sent to an instance of this class.
Instance Method Summary collapse
-
#[](*patterns) ⇒ Object
corresponds to
Rant::FileList[*patterns]
. - #expand_path(path) ⇒ Object
-
#filelist(arg = Rant.__rant_no_value__) ⇒ Object
sys.filelist(arg)
- corresponds to
Rant::FileList(arg)
sys.filelist
-
corresponds to
Rant::FileList.new
.
- corresponds to
-
#glob(*patterns, &block) ⇒ Object
corresponds to
Rant::FileList.glob(*patterns, &block)
. -
#glob_all(*patterns, &block) ⇒ Object
corresponds to
Rant::FileList.glob_all(*patterns, &block)
. -
#ignore(*patterns) ⇒ Object
Preferred over directly modifying var.
-
#initialize(rant) ⇒ SysObject
constructor
A new instance of SysObject.
Methods included from Sys
#absolute_path?, #cd, #clean, #escape, #ln_f, #regular_filename, #root_dir?, #ruby, #safe_ln, #sh, #sp, #split_all, #split_path, #unpack_tgz, #unpack_zip, #write_to_binfile, #write_to_file
Constructor Details
Instance Method Details
#[](*patterns) ⇒ Object
corresponds to Rant::FileList[*patterns]
.
317 318 319 |
# File 'lib/rant/rantsys.rb', line 317 def [](*patterns) RacFileList.new(@rant).hide_dotfiles.include(*patterns) end |
#expand_path(path) ⇒ Object
334 335 336 |
# File 'lib/rant/rantsys.rb', line 334 def (path) File.(@rant.project_to_fs_path(path)) end |
#filelist(arg = Rant.__rant_no_value__) ⇒ Object
sys.filelist(arg)
-
corresponds to
Rant::FileList(arg)
sys.filelist
-
corresponds to
Rant::FileList.new
304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/rant/rantsys.rb', line 304 def filelist(arg = Rant.__rant_no_value__) if Rant.__rant_no_value__.equal?(arg) RacFileList.new(@rant) elsif arg.respond_to?(:to_rant_filelist) arg.to_rant_filelist elsif arg.respond_to?(:to_ary) RacFileList.new(@rant, arg.to_ary) else raise TypeError, "cannot convert #{arg.class} into Rant::FileList" end end |
#glob(*patterns, &block) ⇒ Object
corresponds to Rant::FileList.glob(*patterns, &block)
.
322 323 324 325 326 |
# File 'lib/rant/rantsys.rb', line 322 def glob(*patterns, &block) fl = RacFileList.new(@rant).hide_dotfiles.include(*patterns) fl.ignore(".", "..") if block_given? then yield fl else fl end end |
#glob_all(*patterns, &block) ⇒ Object
corresponds to Rant::FileList.glob_all(*patterns, &block)
.
329 330 331 332 333 |
# File 'lib/rant/rantsys.rb', line 329 def glob_all(*patterns, &block) fl = RacFileList.new(@rant).include(*patterns) fl.ignore(".", "..") # use case: "*.*" as pattern if block_given? then yield fl else fl end end |