rack-iframe-transport 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/rack_iframe_transport.rb +9 -6
  3. metadata +8 -10
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e2b9937c595feb4f5bbe8960205074e61043c898
4
+ data.tar.gz: eebcac09abbcb6c3fe32e77366196d2a8768d43b
5
+ SHA512:
6
+ metadata.gz: 081e8a9899d29d617df667ee7948abb331be49a7f35e45e450344d70f76adbb020cda35855ddfe7e3fa4fc770e1277451964674ab6cc6d328e69bb282cbd0a26
7
+ data.tar.gz: e02fd83815a2f5fcd2ff08dcca67aff4948d54c4de5556a2a23920eeb687acaca2478be60f1b9646eac31bbf2610035fd9ca365ceb6c87da2a91ea12f0e2e407
@@ -1,7 +1,9 @@
1
1
  module Rack
2
2
  class IframeTransport
3
- def initialize(app)
4
- @app = app
3
+ def initialize(app, tag = 'textarea', meta = {})
4
+ @app = app
5
+ @tag = tag
6
+ @meta = meta
5
7
  end
6
8
 
7
9
  def call(env)
@@ -13,6 +15,7 @@ module Rack
13
15
  @request = Rack::Request.new(env)
14
16
 
15
17
  if iframe_transport?
18
+ @enclosed_content_type = @headers['Content-Type'] || 'text/html'
16
19
  @headers['Content-Type'] = 'text/html'
17
20
  [@status, @headers, self]
18
21
  else
@@ -31,18 +34,18 @@ module Rack
31
34
  end
32
35
 
33
36
  def html_document_left
34
- "<!DOCTYPE html><html><body><textarea #{metadata}>"
37
+ "<!DOCTYPE html><html><body><#{@tag} #{metadata}>"
35
38
  end
36
39
 
37
40
  def html_document_right
38
- "</textarea></body></html>"
41
+ "</#{@tag}></body></html>"
39
42
  end
40
43
 
41
44
  def metadata
42
- meta = {}
45
+ meta = @meta.dup
43
46
  meta['data-status'] = @response.status if @response.respond_to? :status
44
47
  meta['data-statusText'] = @response.status_message if @response.respond_to? :status_message
45
- meta['data-type'] = @headers['Content-Type'] if @headers.has_key?('Content-Type')
48
+ meta['data-type'] = @enclosed_content_type
46
49
  meta.map {|key,value| "#{key}='#{value}'" }.join(' ')
47
50
  end
48
51
 
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-iframe-transport
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
5
- prerelease:
4
+ version: 0.1.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Charles Barbier
@@ -10,7 +9,7 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2012-10-19 00:00:00.000000000 Z
12
+ date: 2014-06-26 00:00:00.000000000 Z
14
13
  dependencies: []
15
14
  description:
16
15
  email:
@@ -20,31 +19,30 @@ executables: []
20
19
  extensions: []
21
20
  extra_rdoc_files: []
22
21
  files:
23
- - README.md
24
22
  - LICENSE
23
+ - README.md
25
24
  - lib/rack_iframe_transport.rb
26
25
  homepage: http://github.com/unixcharles/rack-iframe-transport
27
26
  licenses: []
27
+ metadata: {}
28
28
  post_install_message:
29
29
  rdoc_options: []
30
30
  require_paths:
31
31
  - lib
32
32
  required_ruby_version: !ruby/object:Gem::Requirement
33
- none: false
34
33
  requirements:
35
- - - ! '>='
34
+ - - ">="
36
35
  - !ruby/object:Gem::Version
37
36
  version: '0'
38
37
  required_rubygems_version: !ruby/object:Gem::Requirement
39
- none: false
40
38
  requirements:
41
- - - ! '>='
39
+ - - ">="
42
40
  - !ruby/object:Gem::Version
43
41
  version: '0'
44
42
  requirements: []
45
43
  rubyforge_project:
46
- rubygems_version: 1.8.23
44
+ rubygems_version: 2.2.0
47
45
  signing_key:
48
- specification_version: 3
46
+ specification_version: 4
49
47
  summary: Rack middleware for iframe-transport hacks.
50
48
  test_files: []