Class: Legion::Extensions::Agentic::Executive::Inhibition::Helpers::Impulse

Inherits:
Object
  • Object
show all
Defined in:
lib/legion/extensions/agentic/executive/inhibition/helpers/impulse.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, action:, strength:, source: nil, context: {}) ⇒ Impulse

Returns a new instance of Impulse.



14
15
16
17
18
19
20
21
22
# File 'lib/legion/extensions/agentic/executive/inhibition/helpers/impulse.rb', line 14

def initialize(type:, action:, strength:, source: nil, context: {})
  @id         = SecureRandom.uuid
  @type       = type
  @action     = action
  @strength   = strength
  @source     = source
  @context    = context
  @created_at = Time.now.utc
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



12
13
14
# File 'lib/legion/extensions/agentic/executive/inhibition/helpers/impulse.rb', line 12

def action
  @action
end

#contextObject (readonly)

Returns the value of attribute context.



12
13
14
# File 'lib/legion/extensions/agentic/executive/inhibition/helpers/impulse.rb', line 12

def context
  @context
end

#created_atObject (readonly)

Returns the value of attribute created_at.



12
13
14
# File 'lib/legion/extensions/agentic/executive/inhibition/helpers/impulse.rb', line 12

def created_at
  @created_at
end

#idObject (readonly)

Returns the value of attribute id.



12
13
14
# File 'lib/legion/extensions/agentic/executive/inhibition/helpers/impulse.rb', line 12

def id
  @id
end

#sourceObject (readonly)

Returns the value of attribute source.



12
13
14
# File 'lib/legion/extensions/agentic/executive/inhibition/helpers/impulse.rb', line 12

def source
  @source
end

#strengthObject (readonly)

Returns the value of attribute strength.



12
13
14
# File 'lib/legion/extensions/agentic/executive/inhibition/helpers/impulse.rb', line 12

def strength
  @strength
end

#typeObject (readonly)

Returns the value of attribute type.



12
13
14
# File 'lib/legion/extensions/agentic/executive/inhibition/helpers/impulse.rb', line 12

def type
  @type
end

Instance Method Details

#auto_suppressible?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/legion/extensions/agentic/executive/inhibition/helpers/impulse.rb', line 28

def auto_suppressible?
  @strength <= Constants::AUTOMATIC_SUPPRESS_THRESHOLD
end

#overwhelming?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/legion/extensions/agentic/executive/inhibition/helpers/impulse.rb', line 24

def overwhelming?
  @strength >= Constants::IMPULSE_STRENGTHS[:strong]
end