Commit bbe2490f by minad

text? helper improved

parent 13b726aa
......@@ -41,14 +41,7 @@ class MimeMagic
end
# Returns true if type is a text format
def text?
child_of? 'text/plain'
end
# Returns true if type is image
def image?
mediatype == 'image'
end
def text?; mediatype == 'text' || child_of?('text/plain'); end
# Mediatype shortcuts
def image?; mediatype == 'image'; end
......
......@@ -11,6 +11,7 @@ describe 'MimeMagic' do
it 'should have mediatype helpers' do
MimeMagic.new('text/plain').should.be.text
MimeMagic.new('text/html').should.be.text
MimeMagic.new('application/xhtml+xml').should.be.text
MimeMagic.new('application/octet-stream').should.not.be.text
MimeMagic.new('image/png').should.not.be.text
MimeMagic.new('image/png').should.be.image
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment