class Riffer::Rig::Env
Attributes
model
[R]
String?
no_color
[R]
bool
@dynamic no_color, model, reasoning
reasoning
[R]
String?
Public Class Methods
(?Hash[String, String] source) → (Riffer::Rig::Env | Riffer::Rig::Env::Invalid)
Source
# File lib/riffer/rig/env.rb, line 13 def self.load(source = ENV.to_h) env = new(source) model = env.model rejection = model && Riffer::Rig::Settings::ModelOptions.rejection(model) rejection ? Invalid.new("RIFFER_MODEL: #{rejection}") : env end
@rbs source: Hash[String, String] @rbs return: Riffer::Rig::Env | Riffer::Rig::Env::Invalid
(?Hash[String, String] source) → void
Source
# File lib/riffer/rig/env.rb, line 22 def initialize(source = ENV.to_h) @source = source.freeze @no_color = @source.key?('NO_COLOR') @model = self['RIFFER_MODEL'] @reasoning = self['RIFFER_REASONING'] freeze end
@rbs source: Hash[String, String] @rbs return: void
Public Instance Methods
(String name) → String?
Source
# File lib/riffer/rig/env.rb, line 32 def [](name) stripped = @source[name].to_s.strip stripped unless stripped.empty? end
@rbs name: String @rbs return: String?
(Riffer::Rig::ProviderSetup::Field field) → String?
Source
# File lib/riffer/rig/env.rb, line 39 def value_for(field) field.env.filter_map { |name| self[name] }.first end
@rbs field: Riffer::Rig::ProviderSetup::Field @rbs return: String?