Class: Barruun::Configurations::Logging::Sink

Inherits:
Object
  • Object
show all
Defined in:
lib/barruun/configurations/logging/sink.rb

Defined Under Namespace

Classes: ProjectIDNotProvidedError

Instance Method Summary collapse

Constructor Details

#initialize(hash, project_id = ENV["PROJECT_ID"]) ⇒ Sink

Returns a new instance of Sink.



7
8
9
10
11
12
13
14
# File 'lib/barruun/configurations/logging/sink.rb', line 7

def initialize(hash, project_id = ENV["PROJECT_ID"])
  @hash = hash
  @project_id = project_id

  if @project_id.nil?
    raise ProjectIDNotProvidedError, "Project ID not provided"
  end
end

Instance Method Details

#destinationObject



20
21
22
# File 'lib/barruun/configurations/logging/sink.rb', line 20

def destination
  @hash["destination"].gsub(":PROJECT_ID", @project_id)
end

#nameObject



16
17
18
# File 'lib/barruun/configurations/logging/sink.rb', line 16

def name
  @hash["name"]
end

#optionsObject



24
25
26
# File 'lib/barruun/configurations/logging/sink.rb', line 24

def options
  @hash.reject { |k, v| %w(name destination).include?(k) }
end