Class: Quaker::Include

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

Constant Summary collapse

INCLUDE_KEY =
'include'

Instance Method Summary collapse

Instance Method Details

#process(filepath) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/quaker/include.rb', line 6

def process filepath
  dir = File.join(filepath, '..')
  spec = YAML.load(File.read(filepath))
  return spec unless spec.has_key?(INCLUDE_KEY)

  spec
    .delete(INCLUDE_KEY)
    .map {|file| File.expand_path(file, dir) }
    .inject(spec) { |acc, file| acc.merge(process file) }
end