Class: JsSpec::Resources::Dir

Inherits:
File
  • Object
show all
Defined in:
lib/js_spec/resources/dir.rb

Constant Summary

Constants inherited from File

File::MIME_TYPES

Instance Attribute Summary

Attributes inherited from File

#absolute_path, #relative_path

Instance Method Summary collapse

Methods inherited from File

#==, #initialize

Constructor Details

This class inherits a constructor from JsSpec::Resources::File

Instance Method Details

#get(request, response) ⇒ Object



12
13
14
# File 'lib/js_spec/resources/dir.rb', line 12

def get(request, response)
  SpecDirRunner.new(self).get(request, response)
end

#glob(pattern) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/js_spec/resources/dir.rb', line 16

def glob(pattern)
  expanded_pattern = absolute_path + pattern
  ::Dir.glob(expanded_pattern).map do |absolute_globbed_path|
    relative_globbed_path = absolute_globbed_path.gsub(absolute_path, relative_path)
    File.new(absolute_globbed_path, relative_globbed_path)
  end
end

#locate(name) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/js_spec/resources/dir.rb', line 4

def locate(name)
  if file = file(name)
    file
  else
    locate_spec_runner(name)
  end
end