Class: MotionBlender::Interpreters::RequireInterpreter

Inherits:
Base
  • Object
show all
Includes:
Requirable
Defined in:
lib/motion_blender/interpreters/require_interpreter.rb

Instance Attribute Summary

Attributes inherited from Base

#collector, #object

Instance Method Summary collapse

Methods included from Requirable

#find_require, #resolve_path

Methods inherited from Base

#initialize, interprets, key, requirable?

Constructor Details

This class inherits a constructor from MotionBlender::Interpreters::Base

Instance Method Details

#candidates(arg) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/motion_blender/interpreters/require_interpreter.rb', line 18

def candidates arg
  path = Pathname.new(arg)
  dirs = path.relative? && load_path || ['']
  exts = path.extname.empty? ? ['', '.rb'] : ['']
  Enumerator.new do |y|
    dirs.product(exts).each do |dir, ext|
      y << Pathname.new(dir).join("#{path}#{ext}")
    end
  end
end

#interpret(arg) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/motion_blender/interpreters/require_interpreter.rb', line 10

def interpret arg
  req = find_require(arg)
  if req
    requires << req
    req
  end
end