Class: Baykit::BayServer::Docker::WordPress::WordPressDocker
- Inherits:
-
Base::RerouteBase
- Object
- Base::RerouteBase
- Baykit::BayServer::Docker::WordPress::WordPressDocker
- Includes:
- Agent, Bcf, Util
- Defined in:
- lib/baykit/bayserver/docker/word_press/word_press_docker.rb
Instance Attribute Summary collapse
-
#town_path ⇒ Object
readonly
Returns the value of attribute town_path.
Instance Method Summary collapse
Instance Attribute Details
#town_path ⇒ Object (readonly)
Returns the value of attribute town_path.
12 13 14 |
# File 'lib/baykit/bayserver/docker/word_press/word_press_docker.rb', line 12 def town_path @town_path end |
Instance Method Details
#init(elm, parent) ⇒ Object
14 15 16 17 18 |
# File 'lib/baykit/bayserver/docker/word_press/word_press_docker.rb', line 14 def init(elm, parent) super @town_path = parent.location end |
#reroute(twn, uri) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/baykit/bayserver/docker/word_press/word_press_docker.rb', line 20 def reroute(twn, uri) uri_parts = uri.split("?") uri2 = uri_parts[0] if !match(uri2) return uri end rel_path = uri2[twn.name.length .. -1] if rel_path.start_with?("/") rel_path = rel_path[1 .. -1] end rel_parts = rel_path.split("/") check_path = "" rel_parts.each do | path_item | if StringUtil.set? check_path check_path += "/" end check_path += path_item if File.exist?("#{twn.location}/#{check_path}") return uri end end if !File.exist?("#{twn.location}/#{rel_path}") return "#{twn.name}index.php/#{uri[twn.name.length .. -1]}" else return uri end end |