Class: JsTestCore::Resources::Dir
- Defined in:
- lib/js_test_core/resources/dir.rb
Direct Known Subclasses
Constant Summary
Constants inherited from File
Instance Method Summary collapse
Methods inherited from File
Instance Method Details
#get ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/js_test_core/resources/dir.rb', line 14 def get connection.send_head connection.send_body(::Dir.glob("#{absolute_path}/*").inject("") do |html, file| file_basename = ::File.basename(file) html << %Q|<a href="#{file_basename}">#{file_basename}</a>\n| end) end |
#glob(pattern) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/js_test_core/resources/dir.rb', line 22 def glob(pattern) = absolute_path + pattern ::Dir.glob().map do |absolute_globbed_path| relative_globbed_path = absolute_globbed_path.gsub(absolute_path, relative_path) File.new(env.merge( :absolute_path => absolute_globbed_path, :relative_path => relative_globbed_path )) end end |