Fill in vertex base methods

This commit is contained in:
Chris Roberts 2022-04-13 12:09:34 -07:00 committed by Paul Hinze
parent 66c9fd45d6
commit f9e55a8f9d
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0

View File

@ -12,6 +12,7 @@ module VagrantPlugins
autoload :Output, Vagrant.source_root.join("plugins/commands/serve/mappers/internal/graph/vertex/output").to_s
autoload :Root, Vagrant.source_root.join("plugins/commands/serve/mappers/internal/graph/vertex/root").to_s
autoload :Value, Vagrant.source_root.join("plugins/commands/serve/mappers/internal/graph/vertex/value").to_s
# @return [Object] value of vertex
attr_reader :value
@ -42,6 +43,15 @@ module VagrantPlugins
value
end
def ==(v)
v.hash_code == hash_code
end
alias_method :eql?, :==
def hash
hash_code.to_s.chars.map(&:ord).sum.hash
end
def to_s
"<Vertex value=#{value} hash=#{hash_code}>"
end