Sha256: 20aed0a84ca5660d870fd896773722b508a2e73233387dc4913f1414c8960728

Contents?: true

Size: 1.45 KB

Versions: 4

Compression:

Stored size: 1.45 KB

Contents

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, origin_restricted: false)
                @type = type
                @name = name
                @origin_value_only = !!origin_restricted
              end

              def origin_value_only?
                @origin_value_only
              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

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
vagrant-unbundled-2.3.6.0 plugins/commands/serve/mappers/internal/graph/vertex/input.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/plugins/commands/serve/mappers/internal/graph/vertex/input.rb
vagrant-unbundled-2.3.3.0 plugins/commands/serve/mappers/internal/graph/vertex/input.rb
vagrant-unbundled-2.3.2.0 plugins/commands/serve/mappers/internal/graph/vertex/input.rb