Class: Caco::Postgres::ConfGet

Inherits:
Trailblazer::Operation
  • Object
show all
Defined in:
lib/caco/postgres/conf_get.rb

Constant Summary collapse

ProcessSingleValue =
Class.new(Trailblazer::Activity::Signal)
ProcessMultipleValue =
Class.new(Trailblazer::Activity::Signal)

Instance Method Summary collapse

Instance Method Details

#define_what_process(ctx, name: nil, names: nil) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/caco/postgres/conf_get.rb', line 16

def define_what_process(ctx, name: nil, names: nil, **)
  if name and name.is_a?(String)
    return ProcessSingleValue
  elsif names and names.is_a?(Array)
    return ProcessMultipleValue
  else
    return false
  end
end

#process_multiple_values(ctx, names:, aug:) ⇒ Object



30
31
32
33
34
35
# File 'lib/caco/postgres/conf_get.rb', line 30

def process_multiple_values(ctx, names:, aug:, **)
  ctx[:values] = {}
  names.each do |name|
    ctx[:values][name.to_s] = aug.get("/files/postgresql.conf/#{name}")
  end
end

#process_single_value(ctx, name:, aug:) ⇒ Object



26
27
28
# File 'lib/caco/postgres/conf_get.rb', line 26

def process_single_value(ctx, name:, aug:, **)
  ctx[:value] = aug.get("/files/postgresql.conf/#{name}")
end