lib/cloudinary/video_helper.rb in cloudinary-1.0.84 vs lib/cloudinary/video_helper.rb in cloudinary-1.0.85
- old
+ new
@@ -1,9 +1,5 @@
-unless Hash.respond_to?(:deep_symbolize_keys)
- # required prior to Rails 4
- require 'cloudinary/active_support/core_ext/hash/keys'
-end
module CloudinaryHelper
include ActionView::Helpers::CaptureHelper
DEFAULT_POSTER_OPTIONS = { :format => 'jpg', :resource_type => 'video' }
DEFAULT_SOURCE_TYPES = %w(webm mp4 ogv)
DEFAULT_VIDEO_OPTIONS = { :resource_type => 'video' }
@@ -25,10 +21,10 @@
# content_tag( :span, "Cannot present video!")
# end
def cl_video_tag(source, options = {}, &block)
source = strip_known_ext(source)
video_attributes = [:autoplay,:controls,:loop,:muted,:poster, :preload]
- options = DEFAULT_VIDEO_OPTIONS.merge(options).deep_symbolize_keys
+ options = Cloudinary::Utils.deep_symbolize_keys(DEFAULT_VIDEO_OPTIONS.merge(options))
options[:source_types] ||= DEFAULT_SOURCE_TYPES
video_attributes.keep_if{ |key, _| options.has_key?(key)} # required prior to Rails 4.x
video_options = options.extract!(*video_attributes)
if video_options.has_key? :poster