Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
whaleback
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
whaleback
Commits
df3a8d9a
Commit
df3a8d9a
authored
Jul 16, 2018
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add media_klass to filter class by media_type
parent
b6cc9e37
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
obj.rb
lib/whaleback/media/obj.rb
+11
-1
No files found.
lib/whaleback/media/obj.rb
View file @
df3a8d9a
...
...
@@ -36,7 +36,17 @@ module Whaleback
'video'
=>
'Media::Video'
,
'voice'
=>
'Media::Voice'
,
}
class
<<
self
def
media_klass
media_type
Media
::
Obj
::
TypeTrans
[
media_type
.
to_s
].
to_s
.
safe_constantize
||
raise_wrong_media_type
(
media_type
)
end
def
raise_wrong_media_type
raise
Whaleback
::
Errors
::
BaseError
.
new
(
"Invalid media_type:
#{
media_type
}
"
,
-
1
,
400
)
end
end
attr_accessor
:default_mode
def
url
mode
=
nil
...
...
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