Module: Kernel

### Home Classes Methods

### In Files

- lib/require_relative.rb

### Methods

- #require_relative

### Class/Module Index

Quicksearch

- Kernel
- Object
- RequireRelative

No matching classes.

# Kernel

### Public Instance Methods

require_relative(suffix) click to toggle source

    # File lib/require_relative.rb, line 34
    def require_relative(suffix)
      # Rubinius::Location#file stores relative file names while
      # Rubinius::Location#scope.current_script.data_path stores the
      # absolute file name. It is possible (hopeful even) that in the
      # future that Rubinius will change the API to be more
      # intuitive. When that occurs, I'll change the below to that
      # simpler thing.
      scope = Rubinius::StaticScope.of_sender
      script = scope.current_script
      if script
        require File.join(File.dirname(script.data_path), suffix)
      else
        raise LoadError "Something is wrong in trying to get relative path"
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.