Class: Ellipses::Server::Application
- Inherits:
-
Object
- Object
- Ellipses::Server::Application
- Defined in:
- lib/ellipses/server/application.rb
Defined Under Namespace
Classes: Instance
Constant Summary collapse
- DEFAULT_PORT =
0
Instance Attribute Summary collapse
-
#intersperse ⇒ Object
readonly
Returns the value of attribute intersperse.
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
Class Method Summary collapse
Instance Method Summary collapse
- #available!(uri) ⇒ Object
- #available?(uri) ⇒ Boolean
- #dump(uri:, symbols:, port: nil) ⇒ Object
-
#initialize(paths, intersperse: "\n") ⇒ Application
constructor
A new instance of Application.
- #out(uri:, symbols:, port: nil) ⇒ Object
- #validate(uri) ⇒ Object
Constructor Details
#initialize(paths, intersperse: "\n") ⇒ Application
Returns a new instance of Application.
22 23 24 25 26 |
# File 'lib/ellipses/server/application.rb', line 22 def initialize(paths, intersperse: "\n") @paths = setup_paths(paths) @intersperse = intersperse @instances = {} end |
Instance Attribute Details
#intersperse ⇒ Object (readonly)
Returns the value of attribute intersperse.
20 21 22 |
# File 'lib/ellipses/server/application.rb', line 20 def intersperse @intersperse end |
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
20 21 22 |
# File 'lib/ellipses/server/application.rb', line 20 def paths @paths end |
Class Method Details
Instance Method Details
#available!(uri) ⇒ Object
44 45 46 47 48 |
# File 'lib/ellipses/server/application.rb', line 44 def available!(uri) return if available?(uri) raise Error, "Repository not found in path: #{uri}" end |
#available?(uri) ⇒ Boolean
40 41 42 |
# File 'lib/ellipses/server/application.rb', line 40 def available?(uri) !scan(uri).nil? end |
#dump(uri:, symbols:, port: nil) ⇒ Object
32 33 34 |
# File 'lib/ellipses/server/application.rb', line 32 def dump(uri:, symbols:, port: nil) Support.intersperse_arrays(out(uri: uri, symbols: symbols, port: port), intersperse).flatten end |
#out(uri:, symbols:, port: nil) ⇒ Object
28 29 30 |
# File 'lib/ellipses/server/application.rb', line 28 def out(uri:, symbols:, port: nil) [].tap { |chunks| symbols.each { |symbol| chunks.append(*instance(uri, port).repository[symbol]) } } end |
#validate(uri) ⇒ Object
36 37 38 |
# File 'lib/ellipses/server/application.rb', line 36 def validate(uri) raise NotImplementedError end |