Class: Rant::RacFileList

Inherits:
FileList show all
Defined in:
lib/rant/rantsys.rb

Constant Summary

Constants inherited from FileList

FileList::ESC_ALT_SEPARATOR, FileList::ESC_SEPARATOR, FileList::FN_DOTFILE_RX_

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from FileList

#+, #<<, [], #apply_exclude_path, #arglist, #concat, #dirs, #each, #empty?, #exclude, #exclude_name, #exclude_path, #ext, #files, glob, #glob_all, glob_all, #glob_dotfiles, #glob_dotfiles=, #glob_dotfiles?, #glob_unix, #hide_dotfiles, #include, #inspect, #join, #keep, #map, #map!, #no_dir, #no_file, #no_prefix, #no_suffix, #object_inspect, #pop, #push, #reject!, #select, #shift, #size, #sort!, #sub_ext, #to_ary, #to_rant_filelist, #uniq!, #unshift

Methods included from Enumerable

#inject, #select_map

Constructor Details

#initialize(rac, store = []) ⇒ RacFileList

Returns a new instance of RacFileList.


38
39
40
41
42
43
44
45
46
# File 'lib/rant/rantsys.rb', line 38

def initialize(rac, store = [])
    super(store)
    @rac = rac
    @subdir = @rac.current_subdir
    @basedir = Dir.pwd
    @ignore_hash = nil
           @add_ignore_args = []
    update_ignore_rx
end

Instance Attribute Details

#basedirObject (readonly)

Returns the value of attribute basedir


36
37
38
# File 'lib/rant/rantsys.rb', line 36

def basedir
  @basedir
end

#subdirObject (readonly)

Returns the value of attribute subdir


35
36
37
# File 'lib/rant/rantsys.rb', line 35

def subdir
  @subdir
end

Instance Method Details

#copyObject


53
54
55
56
57
58
# File 'lib/rant/rantsys.rb', line 53

def copy
    c = super
    c.instance_variable_set(
        :@add_ignore_args, @add_ignore_args.map { |e| e.dup })
    c
end

#dupObject


47
48
49
50
51
52
# File 'lib/rant/rantsys.rb', line 47

def dup
    c = super
    c.instance_variable_set(
        :@add_ignore_args, @add_ignore_args.dup)
    c
end

#each_cd(&block) ⇒ Object


72
73
74
75
76
77
78
79
# File 'lib/rant/rantsys.rb', line 72

def each_cd(&block)
    old_pwd = Dir.pwd
    Sys.cd(@basedir)
    filelist_resolve if @pending
    @items.each(&block)
ensure
    Sys.cd(old_pwd)
end

#filelist_ignoreObject


59
# File 'lib/rant/rantsys.rb', line 59

alias filelist_ignore ignore

#filelist_resolveObject


68
# File 'lib/rant/rantsys.rb', line 68

alias filelist_resolve resolve

#ignore(*patterns) ⇒ Object


60
61
62
63
# File 'lib/rant/rantsys.rb', line 60

def ignore(*patterns)
    @add_ignore_args.concat patterns
    self
end

#ignore_rxObject


64
65
66
67
# File 'lib/rant/rantsys.rb', line 64

def ignore_rx
    update_ignore_rx
    @ignore_rx
end

#resolveObject


69
70
71
# File 'lib/rant/rantsys.rb', line 69

def resolve
    Sys.cd(@basedir) { filelist_resolve }
end