Class: Ellipses::Server::Repository
- Inherits:
-
Object
- Object
- Ellipses::Server::Repository
- Defined in:
- lib/ellipses/server/repository.rb
Constant Summary collapse
- Error =
Class.new Error
Instance Attribute Summary collapse
-
#global ⇒ Object
readonly
Returns the value of attribute global.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#symbols ⇒ Object
readonly
Returns the value of attribute symbols.
Class Method Summary collapse
Instance Method Summary collapse
- #[](string) ⇒ Object
-
#initialize(symbols:, global:, directory:) ⇒ Repository
constructor
A new instance of Repository.
Constructor Details
#initialize(symbols:, global:, directory:) ⇒ Repository
Returns a new instance of Repository.
12 13 14 15 16 17 |
# File 'lib/ellipses/server/repository.rb', line 12 def initialize(symbols:, global:, directory:) @symbols = symbols @global = global @root = global.root ? ::File.join(directory, global.root) : directory @consumed = Set.new end |
Instance Attribute Details
#global ⇒ Object (readonly)
Returns the value of attribute global.
10 11 12 |
# File 'lib/ellipses/server/repository.rb', line 10 def global @global end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
10 11 12 |
# File 'lib/ellipses/server/repository.rb', line 10 def root @root end |
#symbols ⇒ Object (readonly)
Returns the value of attribute symbols.
10 11 12 |
# File 'lib/ellipses/server/repository.rb', line 10 def symbols @symbols end |
Class Method Details
Instance Method Details
#[](string) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/ellipses/server/repository.rb', line 19 def [](string) (chunks = []).tap do symbols.resolve(string).each { |symbol| yield_symbol(chunks, symbol) } next unless chunks.empty? raise Error, "No chunks resolved for symbol: #{string}, which may already have been consumed" end end |