Class: LlmCostTracker::Configuration::Section
- Inherits:
-
Object
- Object
- LlmCostTracker::Configuration::Section
show all
- Includes:
- Mutability
- Defined in:
- lib/llm_cost_tracker/configuration/section.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(owner) ⇒ Section
Returns a new instance of Section.
39
40
41
|
# File 'lib/llm_cost_tracker/configuration/section.rb', line 39
def initialize(owner)
@owner = owner
end
|
Class Method Details
.attributes(*names) ⇒ Object
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/llm_cost_tracker/configuration/section.rb', line 14
def attributes(*names)
names.each do |name|
attr_reader name
define_method(:"#{name}=") do |value|
ensure_mutable!
instance_variable_set(:"@#{name}", value)
end
end
end
|
.enum_attribute(name, allowed:, default:) ⇒ Object
25
26
27
28
29
30
31
32
|
# File 'lib/llm_cost_tracker/configuration/section.rb', line 25
def enum_attribute(name, allowed:, default:)
attr_reader name
define_method(:"#{name}=") do |value|
ensure_mutable!
instance_variable_set(:"@#{name}", normalize_enum(name, value, allowed, default))
end
end
|
Instance Method Details
#finalize! ⇒ Object
43
|
# File 'lib/llm_cost_tracker/configuration/section.rb', line 43
def finalize!; end
|