Class: WirisPlugin::ServiceResourceLoaderImpl
- Inherits:
-
Object
- Object
- WirisPlugin::ServiceResourceLoaderImpl
- Extended by:
- ServiceResourceLoaderInterface
- Includes:
- Wiris
- Defined in:
- lib/com/wiris/plugin/impl/ServiceResourceLoaderImpl.rb
Instance Method Summary collapse
- #getContent(resource) ⇒ Object
- #getContentType(name) ⇒ Object
-
#initialize ⇒ ServiceResourceLoaderImpl
constructor
A new instance of ServiceResourceLoaderImpl.
Methods included from ServiceResourceLoaderInterface
Constructor Details
#initialize ⇒ ServiceResourceLoaderImpl
Returns a new instance of ServiceResourceLoaderImpl.
10 11 12 |
# File 'lib/com/wiris/plugin/impl/ServiceResourceLoaderImpl.rb', line 10 def initialize() super() end |
Instance Method Details
#getContent(resource) ⇒ Object
13 14 15 |
# File 'lib/com/wiris/plugin/impl/ServiceResourceLoaderImpl.rb', line 13 def getContent(resource) return Storage::newResourceStorage(resource)::read() end |
#getContentType(name) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/com/wiris/plugin/impl/ServiceResourceLoaderImpl.rb', line 16 def getContentType(name) ext = Std::substr(name,name::lastIndexOf(".") + 1) if (ext == "png") return "image/png" else if (ext == "gif") return "image/gif" else if (ext == "jpg") || (ext == "jpeg") return "image/jpeg" else if (ext == "html") || (ext == "htm") return "text/html" else if (ext == "css") return "text/css" else if (ext == "js") return "application/javascript" else if (ext == "txt") return "text/plain" else if (ext == "ini") return "text/plain" else return "application/octet-stream" end end end end end end end end end |