Changeset 312
- Timestamp:
- 05/05/08 03:19:12 (7 months ago)
- Files:
-
- trunk/lib/picolena/templates/app/models/document.rb (modified) (2 diffs)
- trunk/lib/picolena/templates/lib/plain_text_extractors/plain_text.rb (modified) (1 diff)
- trunk/lib/picolena/templates/spec/models/document_spec.rb (modified) (1 diff)
- trunk/lib/picolena/templates/spec/models/plain_text_extractor_spec.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/picolena/templates/app/models/document.rb
r305 r312 12 12 13 13 #Delegating properties to File::method_name(complete_path) 14 [:dirname, :basename, :extname, :ext_as_sym, :file?, : size, :ext_as_sym].each{|method_name|14 [:dirname, :basename, :extname, :ext_as_sym, :file?, :plain_text?, :size, :ext_as_sym].each{|method_name| 15 15 define_method(method_name){File.send(method_name,complete_path)} 16 16 } … … 59 59 # Document.new("presentation.some_weird_extension").supported? => false 60 60 def supported? 61 PlainTextExtractor.supported_extensions.include?(self.ext_as_sym) 61 PlainTextExtractor.supported_extensions.include?(self.ext_as_sym) unless ext_as_sym==:no_extension and !plain_text? 62 62 end 63 63 trunk/lib/picolena/templates/lib/plain_text_extractors/plain_text.rb
r311 r312 12 12 end 13 13 else 14 "binary file!"14 nil 15 15 end 16 16 } trunk/lib/picolena/templates/spec/models/document_spec.rb
r301 r312 79 79 Document.new("spec/test_dirs/indexed/others/ghjopdfg.xyz").should_not be_supported 80 80 end 81 82 it "should not be considered supported if binary" do 83 Document.new("spec/test_dirs/indexed/others/BIN_FILE_WITHOUT_EXTENSION").should_not be_supported 84 end 85 86 81 87 82 88 it "should know its language when enough content is available" do trunk/lib/picolena/templates/spec/models/plain_text_extractor_spec.rb
r310 r312 30 30 31 31 it "should not extract content of binary files" do 32 PlainTextExtractor.extract_content_from("spec/test_dirs/indexed/others/BIN_FILE_WITHOUT_EXTENSION").should == "binary file!"32 PlainTextExtractor.extract_content_from("spec/test_dirs/indexed/others/BIN_FILE_WITHOUT_EXTENSION").should be_blank 33 33 end 34 34 end
