Skip to content

Commit

Permalink
text? helper improved
Browse files Browse the repository at this point in the history
  • Loading branch information
minad committed Jan 23, 2011
1 parent 13b726a commit bbe2490
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
9 changes: 1 addition & 8 deletions lib/mimemagic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,7 @@ def self.remove(type)
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
Expand Down
1 change: 1 addition & 0 deletions test/mimemagic_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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
Expand Down

0 comments on commit bbe2490

Please sign in to comment.