Sha256: 0e57d304e856c54f0ad60bbd3026960c4b0ae30dbab88b9d3332cbaa54e1a5b4

Contents?: true

Size: 584 Bytes

Versions: 2

Compression:

Stored size: 584 Bytes

Contents

require 'require_dir/version'
require 'require_dir/loader'
require 'forwardable'
module RequireDir
  attr_accessor :loader

  def project_folder_from(source: , offset: 0)
    dirs_up = ''
    offset.times { dirs_up << '/..' } if offset > 0
    File.dirname(File.expand_path(source +  dirs_up))
  end

  def init_from_source(source, offset = 0, options = {})
    project_folder = project_folder_from(source: source, offset: offset)
    self.loader = RequireDir::Loader.new(project_folder, options)
  end

  extend Forwardable
  def_delegators :@loader, :dir, :dir_r

  extend self
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
require_dir-0.1.1 lib/require_dir.rb
require_dir-0.1.0 lib/require_dir.rb