Sha256: 4b13d1cb7b61e72ebc249da97a9db2d8f28993a51479746998edf31a6fef7ee8

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

module VagrantPlugins
  module CommandServe
    class Mappers
      class PathnameProtoFromSpec < Mapper
        def initialize
          super(
            inputs: [
              Input.new(type: SDK::FuncSpec::Value) { |arg|
                arg.type == "hashicorp.vagrant.sdk.Args.Path" &&
                  !arg&.value&.value.nil?
              }
            ],
            output: SDK::Args::Path,
            func: method(:converter),
          )
        end

        def converter(fv)
          SDK::Args::Path.decode(fv.value.value)
        end
      end

      class PathnameToProto < Mapper
        def initialize
          super(
            inputs: [Input.new(type: Pathname)],
            output: SDK::Args::Path,
            func: method(:converter),
          )
        end

        def converter(path)
          SDK::Args::Path.new(path: path.to_s)
        end
      end

      class PathnameFromProto < Mapper
        def initialize
          super(
            inputs: [Input.new(type: SDK::Args::Path)],
            output: Pathname,
            func: method(:converter),
          )
        end

        def converter(path)
          Pathname.new(path.path)
        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/pathname.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/plugins/commands/serve/mappers/pathname.rb
vagrant-unbundled-2.3.3.0 plugins/commands/serve/mappers/pathname.rb
vagrant-unbundled-2.3.2.0 plugins/commands/serve/mappers/pathname.rb