Class: Framer::Builder

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, tree) ⇒ Builder

Returns a new instance of Builder.



7
8
9
# File 'lib/framer/builder.rb', line 7

def initialize(path, tree)
  @dirs = get_dirs(path, tree)
end

Instance Attribute Details

#dirsObject (readonly)

Returns the value of attribute dirs.



5
6
7
# File 'lib/framer/builder.rb', line 5

def dirs
  @dirs
end

Instance Method Details

#buildObject



11
12
13
# File 'lib/framer/builder.rb', line 11

def build
  FileUtils.mkdir_p @dirs
end

#get_dirs(root, tree) ⇒ Object



15
16
17
18
19
20
# File 'lib/framer/builder.rb', line 15

def get_dirs(root, tree)
  tree.map do |key, value|
    new_root = File.join(root, key.to_s)
    [new_root, get_dirs(new_root, value)]
  end.flatten
end