Class: DevelopWithPassion::Expander::Copy

Inherits:
Object
  • Object
show all
Defined in:
lib/developwithpassion_expander/copy.rb

Instance Method Summary collapse

Constructor Details

#initialize(copy_target) ⇒ Copy

Returns a new instance of Copy.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/developwithpassion_expander/copy.rb', line 4

def initialize(copy_target)
  array :sources do|a|
    a.read_and_write
    a.mutator :folder do|item|
      register(item,true)
    end
    a.mutator :contents do|item|
      register(item,false)
    end
    a.mutator :all_contents_in do|set_of_folders|
      set_of_folders.each{|item| contents(item)}
    end
    a.mutator :all_folders_in do|set_of_folders|
      set_of_folders.each{|item| folder(item)}
    end
    a.process_using :run, copy_target
  end
end

Instance Method Details

#register(folder, copy_containing_folder = false) ⇒ Object



24
25
26
# File 'lib/developwithpassion_expander/copy.rb', line 24

def register(folder,copy_containing_folder = false)
  @sources.push(copy_containing_folder ? folder : File.join(folder,'.'))
end