Class: Ellipses::Server::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/ellipses/server/application.rb

Defined Under Namespace

Classes: Instance

Constant Summary collapse

DEFAULT_PORT =
0

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#intersperseObject (readonly)

Returns the value of attribute intersperse.



20
21
22
# File 'lib/ellipses/server/application.rb', line 20

def intersperse
  @intersperse
end

#pathsObject (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

.dump(path, *symbols, **kwargs) ⇒ Object



75
76
77
# File 'lib/ellipses/server/application.rb', line 75

def dump(path, *symbols, **kwargs)
  new([Support.dir!(path, error: Error)], **kwargs).dump(uri: '.', symbols: symbols)
end

.validate(path, **kwargs) ⇒ Object



79
80
81
# File 'lib/ellipses/server/application.rb', line 79

def validate(path, **kwargs)
  new([Support.dir!(path, error: Error)], **kwargs).validate('.')
end

Instance Method Details

#available!(uri) ⇒ Object

Raises:



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

Returns:

  • (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

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/ellipses/server/application.rb', line 36

def validate(uri)
  raise NotImplementedError
end