Class: Babl::Operators::Partial::AbsoluteLookupContext
- Inherits:
-
Object
- Object
- Babl::Operators::Partial::AbsoluteLookupContext
- Defined in:
- lib/babl/operators/partial.rb
Instance Attribute Summary collapse
-
#search_path ⇒ Object
readonly
Returns the value of attribute search_path.
Instance Method Summary collapse
- #find(partial_name) ⇒ Object
-
#initialize(search_path) ⇒ AbsoluteLookupContext
constructor
A new instance of AbsoluteLookupContext.
Constructor Details
#initialize(search_path) ⇒ AbsoluteLookupContext
Returns a new instance of AbsoluteLookupContext.
32 33 34 35 |
# File 'lib/babl/operators/partial.rb', line 32 def initialize(search_path) @search_path = search_path raise 'Invalid search path' unless search_path end |
Instance Attribute Details
#search_path ⇒ Object (readonly)
Returns the value of attribute search_path.
30 31 32 |
# File 'lib/babl/operators/partial.rb', line 30 def search_path @search_path end |
Instance Method Details
#find(partial_name) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/babl/operators/partial.rb', line 37 def find(partial_name) query = File.join(search_path, "{#{partial_name}}{.babl,}") path = Dir[query].first return unless path source = File.read(path) [path, source, self] end |