Class: PuppetLanguageServer::Sidecar::Protocol::BaseClass
- Inherits:
-
Object
- Object
- PuppetLanguageServer::Sidecar::Protocol::BaseClass
show all
- Includes:
- Base
- Defined in:
- lib/puppet-languageserver/sidecar_protocol.rb
Instance Method Summary
collapse
Instance Method Details
#==(other) ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 43
def ==(other)
return false unless other.class == self.class
self.class
.instance_methods(false)
.reject { |name| name.to_s.end_with?('=', '!') }
.reject { |name| %i[to_h to_json].include?(name) }
.each do |method_name|
return false unless send(method_name) == other.send(method_name)
end
true
end
|
#eql?(other) ⇒ Boolean
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 56
def eql?(other)
return false unless other.class == self.class
self.class
.instance_methods(false)
.reject { |name| name.to_s.end_with?('=', '!') }
.reject { |name| %i[to_h to_json].include?(name) }
.each do |method_name|
return false unless send(method_name).eql?(other.send(method_name))
end
true
end
|
#from_json!(json_string) ⇒ Object
39
40
41
|
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 39
def from_json!(json_string)
from_h!(::JSON.parse(json_string))
end
|
#hash ⇒ Object
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 69
def hash
props = self.class
.instance_methods(false)
.reject { |name| name.to_s.end_with?('=', '!') }
.reject { |name| %i[to_h to_json].include?(name) }
.map do |method_name|
send(method_name).hash
end
props.hash
end
|
#to_json(*options) ⇒ Object
35
36
37
|
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 35
def to_json(*options)
to_h.to_json(options)
end
|