Module: Eye::Controller::Load

Included in:
Eye::Controller
Defined in:
lib/eye/controller/load.rb

Instance Method Summary collapse

Instance Method Details

#check(filename) ⇒ Object


3
4
5
# File 'lib/eye/controller/load.rb', line 3

def check(filename)
  { filename => catch_load_error(filename) { parse_config(filename).to_h } }
end

#explain(filename) ⇒ Object


7
8
9
# File 'lib/eye/controller/load.rb', line 7

def explain(filename)
  { filename => catch_load_error(filename) { parse_config(filename).to_h } }
end

#load(*args) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/eye/controller/load.rb', line 11

def load(*args)
  args.extract_options!
  obj_strs = args.flatten
  info "=> loading: #{obj_strs}"

  res = Hash.new

  globbing(*obj_strs).each do |filename|
    res[filename] = catch_load_error(filename) do
      cfg = parse_config(filename)
      load_config(filename, cfg)
      nil
    end
  end

  set_proc_line

  info "<= loading: #{obj_strs}"

  res
end