Class: VSM::Homeostat
- Inherits:
-
Object
- Object
- VSM::Homeostat
- Defined in:
- lib/vsm/homeostat.rb
Instance Attribute Summary collapse
-
#limits ⇒ Object
readonly
Returns the value of attribute limits.
Instance Method Summary collapse
- #alarm?(message) ⇒ Boolean
-
#initialize ⇒ Homeostat
constructor
A new instance of Homeostat.
- #usage_snapshot ⇒ Object
Constructor Details
#initialize ⇒ Homeostat
Returns a new instance of Homeostat.
6 7 8 9 |
# File 'lib/vsm/homeostat.rb', line 6 def initialize @limits = { tokens: 8_000, time_ms: 15_000, bytes: 2_000_000 } @usage = Hash.new(0) end |
Instance Attribute Details
#limits ⇒ Object (readonly)
Returns the value of attribute limits.
4 5 6 |
# File 'lib/vsm/homeostat.rb', line 4 def limits @limits end |
Instance Method Details
#alarm?(message) ⇒ Boolean
15 16 17 |
# File 'lib/vsm/homeostat.rb', line 15 def alarm?() .&.dig(:severity) == :algedonic end |
#usage_snapshot ⇒ Object
11 12 13 |
# File 'lib/vsm/homeostat.rb', line 11 def usage_snapshot @usage.dup end |