Class: Kropka::Recipe

Inherits:
Object
  • Object
show all
Defined in:
lib/kropka/recipe.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Recipe

Returns a new instance of Recipe.



7
8
9
10
11
12
13
14
# File 'lib/kropka/recipe.rb', line 7

def initialize(&block)
 self.directories = []
 self.files       = []

 instance_eval(&block) if block_given?

 @@instance = self
end

Instance Attribute Details

#directoriesObject

Returns the value of attribute directories.



21
22
23
# File 'lib/kropka/recipe.rb', line 21

def directories
  @directories
end

#filesObject

Returns the value of attribute files.



21
22
23
# File 'lib/kropka/recipe.rb', line 21

def files
  @files
end

Class Method Details

.instanceObject



3
4
5
# File 'lib/kropka/recipe.rb', line 3

def self.instance
  @@instance
end

Instance Method Details

#apply!Object



16
17
18
19
# File 'lib/kropka/recipe.rb', line 16

def apply!
  directories.map(&:create!)
  files.map(&:copy!)
end