Class: Prez::Files::Paths
- Inherits:
-
Object
- Object
- Prez::Files::Paths
- Defined in:
- lib/prez/files.rb
Instance Attribute Summary collapse
-
#extension ⇒ Object
readonly
Returns the value of attribute extension.
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
Instance Method Summary collapse
- #find(name) ⇒ Object
-
#initialize(extension, dirname) ⇒ Paths
constructor
A new instance of Paths.
Constructor Details
#initialize(extension, dirname) ⇒ Paths
Returns a new instance of Paths.
12 13 14 15 16 17 18 19 20 |
# File 'lib/prez/files.rb', line 12 def initialize(extension, dirname) @extension = extension @paths = [].tap do |paths| paths << File.(".") paths << File.(File.join(".", dirname)) paths << File.(File.join("../../../vendor", dirname), __FILE__) end end |
Instance Attribute Details
#extension ⇒ Object (readonly)
Returns the value of attribute extension.
10 11 12 |
# File 'lib/prez/files.rb', line 10 def extension @extension end |
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
10 11 12 |
# File 'lib/prez/files.rb', line 10 def paths @paths end |
Instance Method Details
#find(name) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/prez/files.rb', line 22 def find(name) paths.each do |path| file = File.join path, "#{name}.#{extension}" if File.exists?(file) return file end end raise Prez::Files::MissingError.new(name, extension) end |