Class: Watirmark::Loader

Inherits:
Object show all
Defined in:
lib/watirmark/loader.rb

Overview

This can be used for files that are page classes or flows. Autoloading them will not actually 'require' the file until a class in that file is used. Note that this does not apply to modules so it's most useful for the page accessors and any files in admin, user, etc.

Instance Method Summary (collapse)

Instance Method Details

- (Object) autoload_files(directory) Also known as: autoload_file



15
16
17
18
19
20
21
22
23
24
# File 'lib/watirmark/loader.rb', line 15

def autoload_files(directory)
  mod = "Watirmark::#{product}"
  each_file_in directory do |file|
    libpath = library_path(file)
    for line in IO.readlines(file)
      _autoload_(mod, $1, libpath) if line =~ /^\s*class\s+([^<]\S+)[\s<]/
      _autoload_(mod, $1, libpath) if line =~ /^\s+([A-Z]\S+)\s+=\s+[A-Z]\S+/
    end
  end
end

- (Object) base_directory(arg = nil)



40
41
42
43
44
45
46
47
48
# File 'lib/watirmark/loader.rb', line 40

def base_directory arg=nil
  if arg
    @base_directory = arg
  elsif @base_directory
    @base_directory
  else
    raise "base_directory not set"
  end
end

- (Object) load_files(directory)

product not used



34
35
36
37
38
# File 'lib/watirmark/loader.rb', line 34

def load_files(directory) # product not used
  each_file_in directory do | file |
    require library_path(file)
  end
end

- (Object) module(arg = nil)



60
61
62
63
64
65
# File 'lib/watirmark/loader.rb', line 60

def module arg=nil
  if arg
    @module = arg
  elseif 
  end
end

- (Object) product(arg = nil)



50
51
52
53
54
55
56
57
58
# File 'lib/watirmark/loader.rb', line 50

def product arg=nil
  if arg
    @product = arg
  elsif @product
    @product
  else 
    raise "product not set"
  end
end