Class: SyntaxTree::LanguageServer::Request::Shape

Inherits:
Object
  • Object
show all
Defined in:
lib/syntax_tree/language_server.rb

Overview

Represents a hash pattern.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values) ⇒ Shape

Returns a new instance of Shape.



179
180
181
# File 'lib/syntax_tree/language_server.rb', line 179

def initialize(values)
  @values = values
end

Instance Attribute Details

#valuesObject (readonly)

Returns the value of attribute values.



177
178
179
# File 'lib/syntax_tree/language_server.rb', line 177

def values
  @values
end

Instance Method Details

#===(other) ⇒ Object



183
184
185
186
187
# File 'lib/syntax_tree/language_server.rb', line 183

def ===(other)
  values.all? do |key, value|
    value == :any ? other.key?(key) : value === other[key]
  end
end