Class: Hash

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

Overview

Implements methods for Hash class.

Instance Method Summary collapse

Instance Method Details

#create_project(path = '.') ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/project_creator.rb', line 6

def create_project(path = '.')
  each_pair do |key, value|
    relative_path = [path, key].join('/')

    case value
    when Hash
      FileUtils.mkdir_p(relative_path)
      value.create_project(relative_path)

    when String
      value.to_file(relative_path)
    end
  end
end