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
13b726aa
Commit
13b726aa
authored
Jan 23, 2011
by
minad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code cleanup, test added
parent
19268104
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
lib/mimemagic.rb
+2
-3
test/mimemagic_test.rb
+6
-0
No files found.
lib/mimemagic.rb
View file @
13b726aa
...
...
@@ -9,9 +9,8 @@ class MimeMagic
# Mime type by type string
def
initialize
(
type
)
@type
=
type
@mediatype
=
@type
.
split
(
'/'
)[
0
]
@subtype
=
@type
.
split
(
'/'
)[
1
]
@type
=
type
@mediatype
,
@subtype
=
type
.
split
(
'/'
,
2
)
end
# Add custom mime type. Arguments:
...
...
test/mimemagic_test.rb
View file @
13b726aa
...
...
@@ -2,6 +2,12 @@ require 'bacon'
require
'mimemagic'
describe
'MimeMagic'
do
it
'should have type, mediatype and subtype'
do
MimeMagic
.
new
(
'text/html'
).
type
.
should
.
equal
'text/html'
MimeMagic
.
new
(
'text/html'
).
mediatype
.
should
.
equal
'text'
MimeMagic
.
new
(
'text/html'
).
subtype
.
should
.
equal
'html'
end
it
'should have mediatype helpers'
do
MimeMagic
.
new
(
'text/plain'
).
should
.
be
.
text
MimeMagic
.
new
(
'text/html'
).
should
.
be
.
text
...
...
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