Method: Builder#import

Defined in:
lib/rubidity/builder.rb

#import(path) ⇒ Object

examples: import ‘./ERC20’



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/rubidity/builder.rb', line 43

def import( path )
  puts "==> importing >#{path}<..."
  code = File.open( "contracts/#{path}.rb", 'r:utf-8' ) { |f| f.read }

  basename = File.basename( path )

  if @paths.include?( basename )
      puts "   skipping import; already loaded"
  else
     @paths << basename
     lineno   = 1  ## note: starting at line 1 (NOT 0!!!)
     instance_eval( code, basename, lineno )
  end
end