Class: Psychic::Runner::SampleFinder
- Inherits:
-
Object
- Object
- Psychic::Runner::SampleFinder
- Defined in:
- lib/psychic/runner/sample_finder.rb
Instance Attribute Summary collapse
-
#hints ⇒ Object
Returns the value of attribute hints.
Instance Method Summary collapse
- #find_sample(name) ⇒ Object
-
#initialize(search_dir = Dir.pwd, hints = nil) ⇒ SampleFinder
constructor
A new instance of SampleFinder.
- #known_samples ⇒ Object
Constructor Details
#initialize(search_dir = Dir.pwd, hints = nil) ⇒ SampleFinder
Returns a new instance of SampleFinder.
6 7 8 9 |
# File 'lib/psychic/runner/sample_finder.rb', line 6 def initialize(search_dir = Dir.pwd, hints = nil) @search_dir = search_dir @hints = hints || {} end |
Instance Attribute Details
#hints ⇒ Object
Returns the value of attribute hints.
4 5 6 |
# File 'lib/psychic/runner/sample_finder.rb', line 4 def hints @hints end |
Instance Method Details
#find_sample(name) ⇒ Object
17 18 19 20 |
# File 'lib/psychic/runner/sample_finder.rb', line 17 def find_sample(name) file = find_in_hints(name) || Psychic::Util.find_file_by_alias(name, @search_dir) CodeSample.new(name, file, @search_dir) end |
#known_samples ⇒ Object
11 12 13 14 15 |
# File 'lib/psychic/runner/sample_finder.rb', line 11 def known_samples hints.map do | name, file | CodeSample.new(name, file, @search_dir) end end |