File: open_uri.rb

package info (click to toggle)
ruby-data-uri 0.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 76 kB
  • sloc: ruby: 81; makefile: 3
file content (22 lines) | stat: -rw-r--r-- 305 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module URI

  class Data

    def open
      io = StringIO.new(data)
      OpenURI::Meta.init(io)
      io.meta_add_field('content-type', content_type)
      if block_given?
        begin
          yield io
        ensure
          io.close
        end
      else
        io
      end
    end

  end

end