Class: Dumbo::BindingLoader

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ BindingLoader

Returns a new instance of BindingLoader.



9
10
11
# File 'lib/dumbo/binding_loader.rb', line 9

def initialize(file)
  @file = file
end

Class Method Details

.load_patternObject



5
6
7
# File 'lib/dumbo/binding_loader.rb', line 5

def self.load_pattern
  /\s*--\s*load +([^\s'";]+)/
end

Instance Method Details

#loadObject



13
14
15
16
17
18
19
20
# File 'lib/dumbo/binding_loader.rb', line 13

def load
  load_list.reduce({}) do |result, file|
    yaml = Pathname.new(file).sub_ext('.yml')
    bind = YAML.load_file(yaml)

    result.merge(bind)
  end
end