2022-04-25 12:26:56 -05:00

53 lines
1.3 KiB
Ruby

module VagrantPlugins
module CommandServe
class Mappers
module Internal
class Graph
class Vertex
# Vertex that represents an input value
# for a method
class Input < Vertex
attr_reader :type
attr_reader :name
def initialize(type:, name: nil)
@type = type
@name = name
end
# When an input Vertex is called,
# we simply set the value for use
def call(arg)
@value = arg
end
def to_s
info = {
name: name,
type: type,
hash: hash_code,
}.compact.map { |k, v|
"#{k} = #{v}"
}.join(" ")
"<Vertex:Input #{info}>"
end
def inspect
info = {
name: name,
type: type,
value: value,
hash: hash_code,
}.map { |k, v|
"#{k} = #{v}"
}.join(" ")
"<#{self.class.name} #{info}>"
end
end
end
end
end
end
end
end