Class: RText::Frontend::ConnectorManager
- Inherits:
-
Object
- Object
- RText::Frontend::ConnectorManager
- Defined in:
- lib/rtext/frontend/connector_manager.rb
Defined Under Namespace
Classes: ConnectorDesc
Instance Method Summary collapse
- #all_connectors ⇒ Object
- #connector_for_file(file) ⇒ Object
-
#initialize(options = {}) ⇒ ConnectorManager
constructor
A new instance of ConnectorManager.
Constructor Details
#initialize(options = {}) ⇒ ConnectorManager
Returns a new instance of ConnectorManager.
10 11 12 13 14 15 16 17 |
# File 'lib/rtext/frontend/connector_manager.rb', line 10 def initialize(={}) @logger = [:logger] @connector_descs = {} @connector_listener = [:connect_callback] @keep_outfile = [:keep_outfile] @outfile_provider = [:outfile_provider] @connection_timeout = [:connection_timeout] end |
Instance Method Details
#all_connectors ⇒ Object
43 44 45 |
# File 'lib/rtext/frontend/connector_manager.rb', line 43 def all_connectors @connector_descs.values.collect{|v| v.connector} end |
#connector_for_file(file) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rtext/frontend/connector_manager.rb', line 21 def connector_for_file(file) config = Config.find_service_config(file) if config file_pattern = Config.file_pattern(file) key = desc_key(config, file_pattern) desc = @connector_descs[key] if desc if desc.checksum == config_checksum(config) desc.connector else # connector must be replaced desc.connector.stop create_connector(config, file_pattern) end else create_connector(config, file_pattern) end else nil end end |