louismullie/treat — pull request #40 by turadg (2013-01-15 16:52:45+00:00)
Title: Fix method contract bug in detect_format

Calls to detect_format() passed a file, but the method expected a filename.

````
/Users/turadg/Code/Ruby/treat/lib/treat/entities/entity/buildable.rb:
214 else
215 fmt = Treat::Workers::Formatters::
216: Readers::Autoselect.detect_format(file,def_fmt)
217 from_raw_file(file, fmt)
218 end

/Users/turadg/Code/Ruby/treat/lib/treat/workers/formatters/readers/autoselect.rb:
13 def self.read(document, options = {})
14 options = DefaultOptions.merge(options)
15: fmt = detect_format(document.file, options[:default_to])
16 Treat::Workers::Formatters::Readers.
17 const_get(fmt.cc).read(document,options)
18 end
19
20: def self.detect_format(filename, default_to = nil)
21
22 default_to ||= DefaultOptions[:default_to]

3 matches across 2 files
````

This patch changes the parameter to a file as expected.