Class: Tap::Test::Env

Inherits:
Object
  • Object
show all
Defined in:
lib/tap/test/env.rb

Instance Method Summary collapse

Instance Method Details

#constant(const_str, type = nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/tap/test/env.rb', line 8

def constant(const_str, type=nil)
  return const_str if const_str.kind_of?(Module)
  
  begin
    current = Object
    const_str.split(/::/).each do |const_name|
      current = current.const_get(const_name)
    end
    current
  rescue(NameError)
    raise "uninitialized constant: #{const_str.inspect}"
  end
end

#path(type) ⇒ Object



4
5
6
# File 'lib/tap/test/env.rb', line 4

def path(type)
  [File.expand_path(type.to_s)]
end