Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mimemagic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
mimemagic
Commits
bbe2490f
Commit
bbe2490f
authored
Jan 23, 2011
by
minad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
text? helper improved
parent
13b726aa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
8 deletions
+2
-8
lib/mimemagic.rb
+1
-8
test/mimemagic_test.rb
+1
-0
No files found.
lib/mimemagic.rb
View file @
bbe2490f
...
...
@@ -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
...
...
test/mimemagic_test.rb
View file @
bbe2490f
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment