Sha256: c8677cded4fa0a68ba86395ecede7cd1724ba9f97a6e28205eab06d5d2091111

Contents?: true

Size: 461 Bytes

Versions: 1

Compression:

Stored size: 461 Bytes

Contents

module Terminus
  class Proxy
    
    module Rewrite
      attr_writer :dock_host
      
      def each(&block)
        handler = lambda do |fragment|
          block.call(rewrite(fragment))
        end
        super(&handler)
      end
      
      def rewrite(fragment)
        fragment.gsub(/\b(action|href)=('[^']*?'|"[^"]*?"|\S*)/i) do
          %Q{#{$1}="#{ Terminus.rewrite_remote($2[1..-2], @dock_host) }"}
        end
      end
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
terminus-0.4.0 lib/terminus/proxy/rewrite.rb