Class: Cerbos::Hub::Stores::File

Inherits:
Object
  • Object
show all
Defined in:
lib/cerbos/hub/stores/file.rb

Overview

A file in a store.

Instance Attribute Summary collapse

Instance Attribute Details

#contentsString (readonly)

The contents of the file (with binary encoding).

Returns:

  • (String)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cerbos/hub/stores/file.rb', line 7

File = Output.new_class(:path, :contents) do
  # @!attribute [r] path
  #   The path of the file.
  #
  #   @return [String]

  # @!attribute [r] contents
  #   The contents of the file (with binary encoding).
  #
  #   @return [String]
  def self.from_protobuf(file)
    new(path: file.path, contents: file.contents)
  end

  # @private
  def to_protobuf
    Protobuf::Cerbos::Cloud::Store::V1::File.new(path:, contents:)
  end
end

#pathString (readonly)

The path of the file.

Returns:

  • (String)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cerbos/hub/stores/file.rb', line 7

File = Output.new_class(:path, :contents) do
  # @!attribute [r] path
  #   The path of the file.
  #
  #   @return [String]

  # @!attribute [r] contents
  #   The contents of the file (with binary encoding).
  #
  #   @return [String]
  def self.from_protobuf(file)
    new(path: file.path, contents: file.contents)
  end

  # @private
  def to_protobuf
    Protobuf::Cerbos::Cloud::Store::V1::File.new(path:, contents:)
  end
end