Class: LanguageServer::Project::Node
- Inherits:
-
Object
- Object
- LanguageServer::Project::Node
show all
- Defined in:
- lib/language_server/project/node.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.attribute_names ⇒ Object
19
20
21
|
# File 'lib/language_server/project/node.rb', line 19
def attribute_names
@attribute_names ||= superclass.respond_to?(:attribute_names) ? superclass.attribute_names.dup : []
end
|
.attributes(*attrs) ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/language_server/project/node.rb', line 5
def attributes(*attrs)
attr_accessor(*attrs)
attribute_names.concat(attrs)
class_eval "def initialize(\#{attribute_names.map {|n| \"\#{n}:\" }.join(',')})\n \#{\n attribute_names.map {|n|\n \"@\#{n} = \#{n}\"\n }.join(\"\\n\")\n }\nend\n RUBY\nend\n", __FILE__, __LINE__
|
Instance Method Details
#==(other) ⇒ Object
33
34
35
|
# File 'lib/language_server/project/node.rb', line 33
def ==(other)
eql?(other)
end
|
#attributes ⇒ Object
41
42
43
44
45
|
# File 'lib/language_server/project/node.rb', line 41
def attributes
self.class.attribute_names.map {|a|
[a, public_send(a)]
}.to_h
end
|
#eql?(other) ⇒ Boolean
29
30
31
|
# File 'lib/language_server/project/node.rb', line 29
def eql?(other)
other.instance_of?(self.class) && attributes == other.attributes
end
|
#hash ⇒ Object
37
38
39
|
# File 'lib/language_server/project/node.rb', line 37
def hash
self.attributes.hash
end
|
#local_path ⇒ Object
27
|
# File 'lib/language_server/project/node.rb', line 27
def local_path; path.local_path; end
|
#remote_path ⇒ Object
26
|
# File 'lib/language_server/project/node.rb', line 26
def remote_path; path.remote_path; end
|