Sha256: d1a93988c8b35031e8dc1c6d396d8a9c30e371b59f2cd3b7688d6e1aea33ef9c

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

module VagrantPlugins
  module CommandServe
    module Util
      module HasSeeds
        # Provides seed value registration.
        module Service
          def seed(req, ctx)
            @seeds = req
            Empty.new
          end

          def seeds(req, ctx)
            return SDK::Args::Seeds.new if @seeds.nil?
            @seeds
          end
        end

        # Provides seed access.
        module Client
          def seed(*args)
            raise NotImplementedError,
              "Seeding is currently not supported via Ruby client"
          end

          def seeds
            client.seeds(Empty.new)
          end

          def seed_protos
            seeds.typed.map { |any|
              SDK::FuncSpec::Value.new(
                name: "",
                type: any.type_name,
                value: any,
              )
            } + seeds.named.map { |name, any|
              SDK::FuncSpec::Value.new(
                name: name,
                type: any.type_name,
                value: any,
              )
            }
          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/util/has_seeds.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/plugins/commands/serve/util/has_seeds.rb
vagrant-unbundled-2.3.3.0 plugins/commands/serve/util/has_seeds.rb
vagrant-unbundled-2.3.2.0 plugins/commands/serve/util/has_seeds.rb