Class: Scrape::DefaultLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/scrape/default_loader.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ DefaultLoader

Returns a new instance of DefaultLoader.



2
3
4
# File 'lib/scrape/default_loader.rb', line 2

def initialize app
  @app = app
end

Instance Method Details

#load(path) ⇒ Object



6
7
8
9
10
11
# File 'lib/scrape/default_loader.rb', line 6

def load path
  path = File.expand_path path
  File.exists? path or raise Scrape::FileNotFound, path
  dsl = Scrape::DSL.new @app
  dsl.instance_eval File.read(path), path
end