Sha256: 6febff807237d73af7f556a9807d01cd08a3fc7108744bb19aae355bdef41607
Contents?: true
Size: 1.5 KB
Versions: 26
Compression:
Stored size: 1.5 KB
Contents
require "enju_manifestation_viewer/engine" require "enju_manifestation_viewer/manifestation_viewer_helper" require "enju_manifestation_viewer/book_jacket_helper" require "addressable/uri" module EnjuManifestationViewer def self.included(base) base.extend ClassMethods end module ClassMethods def enju_manifestation_viewer include EnjuManifestationViewer::InstanceMethods end end module InstanceMethods def youtube_id if access_address url = ::Addressable::URI.parse(access_address) if url.host =~ /youtube\.com$/ and url.path == "/watch" return CGI.parse(url.query)["v"][0] end end end def nicovideo_id if access_address url = ::Addressable::URI.parse(access_address) if url.host =~ /nicovideo\.jp$/ and url.path =~ /^\/watch/ return url.path.split("/")[2] end end end def flickr if access_address url = ::Addressable::URI.parse(access_address) paths = url.path.split('/') if url.host =~ /^www\.flickr\.com$/ and paths[1] == 'photos' and paths[2] info = {} if paths[3] == "sets" info[:user] = paths[2] info[:set_id] = paths[4] return info end end end end end end ActiveRecord::Base.send :include, EnjuManifestationViewer ActionView::Base.send :include, EnjuManifestationViewer::ManifestationViewerHelper ActionView::Base.send :include, EnjuManifestationViewer::BookJacketHelper
Version data entries
26 entries across 26 versions & 2 rubygems