Module: FunWith::Patterns::Loader::LoadingStyles::Eval

Defined in:
lib/fun_with/patterns/loader/loading_styles/eval.rb

Instance Method Summary collapse

Instance Method Details

#loader_pattern_load_item(file) ⇒ Object

Default behavior: read the file, evaluate it, expect a ruby object of the class that the loader pattern is installed on. If anything goes wrong (file no exist, syntax error), returns a nil.

Override in your class if you need your files translated into objects differently.



12
13
14
15
16
17
18
# File 'lib/fun_with/patterns/loader/loading_styles/eval.rb', line 12

def loader_pattern_load_item( file )
  self.loader_pattern_rescue_failing_item_load( file ) do
    obj = eval( file.read )

    return obj
  end
end