aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/body_parts/open_uri.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view/body_parts/open_uri.rb')
-rw-r--r--actionpack/lib/action_view/body_parts/open_uri.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/body_parts/open_uri.rb b/actionpack/lib/action_view/body_parts/open_uri.rb
new file mode 100644
index 0000000000..8ebd17b4a1
--- /dev/null
+++ b/actionpack/lib/action_view/body_parts/open_uri.rb
@@ -0,0 +1,13 @@
+require 'action_view/body_parts/threaded'
+require 'open-uri'
+
+module ActionView
+ module BodyParts
+ class OpenUri < Threaded
+ def initialize(url)
+ url = URI::Generic === url ? url : URI.parse(url)
+ super(true) { |parts| parts << url.read }
+ end
+ end
+ end
+end