Module: Terminus::Proxy::Rewrite
- Defined in:
- lib/terminus/proxy/rewrite.rb
Instance Attribute Summary collapse
-
#dock_host ⇒ Object
writeonly
Sets the attribute dock_host.
Instance Method Summary collapse
Instance Attribute Details
#dock_host=(value) ⇒ Object (writeonly)
Sets the attribute dock_host
5 6 7 |
# File 'lib/terminus/proxy/rewrite.rb', line 5 def dock_host=(value) @dock_host = value end |
Instance Method Details
#each(&block) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/terminus/proxy/rewrite.rb', line 7 def each(&block) handler = lambda do |fragment| block.call(rewrite(fragment)) end super(&handler) end |
#rewrite(fragment) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/terminus/proxy/rewrite.rb', line 14 def rewrite(fragment) fragment.gsub(/\b(action|href)=('[^']*?'|"[^"]*?")/i) do q = $2.chars.first %Q{#{$1}=#{q}#{ Terminus.rewrite_remote($2[1..-2], @dock_host) }#{q}} end end |