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
66c3c660
Commit
66c3c660
authored
Jul 25, 2013
by
Daniel Mendler
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14 from wbond/master
Fixed for Ruby 2.0
parents
89bb5162
29e48a84
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
README.markdown
+9
-0
lib/mimemagic.rb
+7
-2
No files found.
README.markdown
View file @
66c3c660
...
...
@@ -17,6 +17,15 @@ API
http://rdoc.info/github/minad/mimemagic/frames/file/README
Tests
=====
```
bundle install
rake test
```
Authors
=======
...
...
lib/mimemagic.rb
View file @
66c3c660
...
...
@@ -109,12 +109,17 @@ class MimeMagic
def
self
.
magic_match
(
io
,
matches
)
matches
.
any?
do
|
offset
,
value
,
children
|
value
=
value
.
b
if
value
.
respond_to?
(
:b
)
match
=
if
Range
===
offset
io
.
seek
(
offset
.
begin
)
io
.
read
(
offset
.
end
-
offset
.
begin
+
value
.
length
).
include?
(
value
)
io_val
=
io
.
read
(
offset
.
end
-
offset
.
begin
+
value
.
length
)
io_val
=
io_val
.
b
if
io_val
.
respond_to?
(
:b
)
io_val
.
include?
(
value
)
else
io
.
seek
(
offset
)
value
==
io
.
read
(
value
.
length
)
io_val
=
io
.
read
(
value
.
length
)
io_val
=
io_val
.
b
if
io_val
.
respond_to?
(
:b
)
value
==
io_val
end
match
&&
(
!
children
||
magic_match
(
io
,
children
))
end
...
...
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