Class: Baykit::BayServer::Docker::BuiltIn::BuiltInTownDocker
- Inherits:
-
Baykit::BayServer::Docker::Base::DockerBase
- Object
- Baykit::BayServer::Docker::Base::DockerBase
- Baykit::BayServer::Docker::BuiltIn::BuiltInTownDocker
- Includes:
- Bcf, Baykit::BayServer::Docker, Town
- Defined in:
- lib/baykit/bayserver/docker/built_in/built_in_town_docker.rb
Constant Summary
Constants included from Town
Town::MATCH_TYPE_CLOSE, Town::MATCH_TYPE_MATCHED, Town::MATCH_TYPE_NOT_MATCHED
Instance Attribute Summary collapse
-
#city ⇒ Object
readonly
Returns the value of attribute city.
-
#clubs ⇒ Object
readonly
Returns the value of attribute clubs.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#permission_list ⇒ Object
readonly
Returns the value of attribute permission_list.
-
#reroute_list ⇒ Object
readonly
Returns the value of attribute reroute_list.
-
#welcome ⇒ Object
readonly
Returns the value of attribute welcome.
Attributes inherited from Baykit::BayServer::Docker::Base::DockerBase
Instance Method Summary collapse
-
#init(elm, parent) ⇒ Object
Implements Docker.
- #init_docker(dkr) ⇒ Object
- #init_key_val(kv) ⇒ Object
-
#initialize ⇒ BuiltInTownDocker
constructor
A new instance of BuiltInTownDocker.
- #matches(uri) ⇒ Object
-
#reroute(uri) ⇒ Object
Implements Town.
- #tour_admitted(tur) ⇒ Object
Methods included from Town
#check_admitted, #welcome_file
Methods included from Docker
Methods inherited from Baykit::BayServer::Docker::Base::DockerBase
Constructor Details
#initialize ⇒ BuiltInTownDocker
Returns a new instance of BuiltInTownDocker.
25 26 27 28 29 30 31 32 33 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_town_docker.rb', line 25 def initialize @name = nil @location = nil @welcome = nil @clubs = [] @permission_list = [] @city = nil @reroute_list = [] end |
Instance Attribute Details
#city ⇒ Object (readonly)
Returns the value of attribute city.
22 23 24 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_town_docker.rb', line 22 def city @city end |
#clubs ⇒ Object (readonly)
Returns the value of attribute clubs.
20 21 22 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_town_docker.rb', line 20 def clubs @clubs end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
18 19 20 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_town_docker.rb', line 18 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
17 18 19 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_town_docker.rb', line 17 def name @name end |
#permission_list ⇒ Object (readonly)
Returns the value of attribute permission_list.
21 22 23 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_town_docker.rb', line 21 def @permission_list end |
#reroute_list ⇒ Object (readonly)
Returns the value of attribute reroute_list.
23 24 25 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_town_docker.rb', line 23 def reroute_list @reroute_list end |
#welcome ⇒ Object (readonly)
Returns the value of attribute welcome.
19 20 21 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_town_docker.rb', line 19 def welcome @welcome end |
Instance Method Details
#init(elm, parent) ⇒ Object
Implements Docker
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_town_docker.rb', line 39 def init(elm, parent) arg = elm.arg if !arg.start_with? "/" arg = "/" + arg end @name = arg if !@name.end_with? "/" @name = @name + "/" end @city = parent super end |
#init_docker(dkr) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_town_docker.rb', line 54 def init_docker(dkr) if dkr.kind_of?(Baykit::BayServer::Docker::Club) @clubs.append(dkr) elsif dkr.kind_of?(Baykit::BayServer::Docker::Permission) @permission_list.append(dkr) elsif dkr.kind_of?(Baykit::BayServer::Docker::Reroute) @reroute_list.append(dkr) else return super end return true end |
#init_key_val(kv) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_town_docker.rb', line 67 def init_key_val(kv) case kv.key.downcase when "location" @location = kv.value if !File.absolute_path?(@location) @location = BayServer.get_location(@location) if !File.directory?(@location) raise ConfigException.new(kv.file_name, kv.line_no, BayMessage.get(:CFG_INVALID_LOCATION, kv.value)) end end when "index" @welcome = kv.value when "welcome" @welcome = kv.value else return super end return true; end |
#matches(uri) ⇒ Object
98 99 100 101 102 103 104 105 106 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_town_docker.rb', line 98 def matches(uri) if uri.start_with?(@name) return MATCH_TYPE_MATCHED elsif uri + "/" == name return MATCH_TYPE_CLOSE else return MATCH_TYPE_NOT_MATCHED end end |
#reroute(uri) ⇒ Object
Implements Town
91 92 93 94 95 96 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_town_docker.rb', line 91 def reroute(uri) @reroute_list.each do |r| uri = r.reroute(self, uri) end return uri end |
#tour_admitted(tur) ⇒ Object
108 109 110 111 112 |
# File 'lib/baykit/bayserver/docker/built_in/built_in_town_docker.rb', line 108 def tour_admitted(tur) @permission_list.each do |p| p.tour_admitted(tur) end end |