Class: LanguageServer::Protocol::Interface::RelativePattern
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::RelativePattern
- Defined in:
- lib/language_server/protocol/interface/relative_pattern.rb
Overview
A relative pattern is a helper to construct glob patterns that are matched relatively to a base URI. The common value for a ‘baseUri` is a workspace folder root, but it can be another absolute URI as well.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#base_uri ⇒ string | WorkspaceFolder
A workspace folder or a base URI to which this pattern will be matched against relatively.
-
#initialize(base_uri:, pattern:) ⇒ RelativePattern
constructor
A new instance of RelativePattern.
-
#pattern ⇒ string
The actual glob pattern;.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(base_uri:, pattern:) ⇒ RelativePattern
Returns a new instance of RelativePattern.
10 11 12 13 14 15 16 17 |
# File 'lib/language_server/protocol/interface/relative_pattern.rb', line 10 def initialize(base_uri:, pattern:) @attributes = {} @attributes[:baseUri] = base_uri @attributes[:pattern] = pattern @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
36 37 38 |
# File 'lib/language_server/protocol/interface/relative_pattern.rb', line 36 def attributes @attributes end |
Instance Method Details
#base_uri ⇒ string | WorkspaceFolder
A workspace folder or a base URI to which this pattern will be matched against relatively.
24 25 26 |
# File 'lib/language_server/protocol/interface/relative_pattern.rb', line 24 def base_uri attributes.fetch(:baseUri) end |
#pattern ⇒ string
The actual glob pattern;
32 33 34 |
# File 'lib/language_server/protocol/interface/relative_pattern.rb', line 32 def pattern attributes.fetch(:pattern) end |
#to_hash ⇒ Object
38 39 40 |
# File 'lib/language_server/protocol/interface/relative_pattern.rb', line 38 def to_hash attributes end |
#to_json(*args) ⇒ Object
42 43 44 |
# File 'lib/language_server/protocol/interface/relative_pattern.rb', line 42 def to_json(*args) to_hash.to_json(*args) end |