Sha256: 10f18185b26dc5617fb02a08525ce654f34d2e1c0b7f9492b2b5e5c991212db6

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

module VagrantPlugins
  module CommandServe
    class Client
      class StateBag < Client
        # @param [String]
        # @return [String]
        def get(key)
          req = SDK::StateBag::GetRequest.new(
            key: key
          )
          client.get(req).value
        end
        alias_method :[], :get

        # @param [String]
        # @return [String, Boolean]
        def get_ok(key)
          req = SDK::StateBag::GetRequest.new(
            key: key
          )
          resp = client.get_ok(req)
          return resp.value, resp.ok
        end

        # @param [String, String]
        # @return []
        def put(key, val)
          req = SDK::StateBag::PutRequest.new(
            key: key, value: val
          )
          client.put(req)
        end
        alias_method :[]=, :put

        # @param [String]
        # @return []
        def remove(key)
          req = SDK::StateBag::RemoveRequest.new(
            key: key
          )
          client.remove(req)
        end
        alias_method :delete, :remove

      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/client/state_bag.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/plugins/commands/serve/client/state_bag.rb
vagrant-unbundled-2.3.3.0 plugins/commands/serve/client/state_bag.rb
vagrant-unbundled-2.3.2.0 plugins/commands/serve/client/state_bag.rb