Class: NoBrainer::Generators::InstallGenerator::RequireProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/rails/generators/nobrainer/install_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRequireProxy

Returns a new instance of RequireProxy.



13
14
15
# File 'lib/rails/generators/nobrainer/install_generator.rb', line 13

def initialize
  self.required_paths = []
end

Instance Attribute Details

#required_pathsObject

Returns the value of attribute required_paths.



12
13
14
# File 'lib/rails/generators/nobrainer/install_generator.rb', line 12

def required_paths
  @required_paths
end

Instance Method Details

#require(path) ⇒ Object



17
18
19
# File 'lib/rails/generators/nobrainer/install_generator.rb', line 17

def require(path)
  self.required_paths << path
end

#resolve_require_path(path) ⇒ Object



21
22
23
# File 'lib/rails/generators/nobrainer/install_generator.rb', line 21

def resolve_require_path(path)
  $:.map { |dir| File.join(dir, path) }.detect { |f| File.exists?(f) }
end