Class: NoBrainer::Generators::InstallGenerator::RequireProxy
- Inherits:
-
Object
- Object
- NoBrainer::Generators::InstallGenerator::RequireProxy
- Defined in:
- lib/rails/generators/nobrainer/install_generator.rb
Instance Attribute Summary collapse
-
#required_paths ⇒ Object
Returns the value of attribute required_paths.
Instance Method Summary collapse
-
#initialize ⇒ RequireProxy
constructor
A new instance of RequireProxy.
- #require(path) ⇒ Object
- #resolve_require_path(path) ⇒ Object
Constructor Details
#initialize ⇒ RequireProxy
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_paths ⇒ Object
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 |