Class: Legion::Extensions::Agentic::Social::PerspectiveShifting::Helpers::Perspective

Inherits:
Object
  • Object
show all
Defined in:
lib/legion/extensions/agentic/social/perspective_shifting/helpers/perspective.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, perspective_type:, priorities: [], expertise_domains: [], empathy_level: Constants::DEFAULT_EMPATHY, bias_toward: nil) ⇒ Perspective

Returns a new instance of Perspective.



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/legion/extensions/agentic/social/perspective_shifting/helpers/perspective.rb', line 15

def initialize(name:, perspective_type:, priorities: [], expertise_domains: [],
               empathy_level: Constants::DEFAULT_EMPATHY, bias_toward: nil)
  @id               = SecureRandom.uuid
  @name             = name
  @perspective_type = perspective_type
  @priorities       = Array(priorities)
  @expertise_domains = Array(expertise_domains)
  @empathy_level    = empathy_level.clamp(0.0, 1.0)
  @bias_toward      = bias_toward
  @created_at       = Time.now.utc
end

Instance Attribute Details

#bias_towardObject (readonly)

Returns the value of attribute bias_toward.



12
13
14
# File 'lib/legion/extensions/agentic/social/perspective_shifting/helpers/perspective.rb', line 12

def bias_toward
  @bias_toward
end

#created_atObject (readonly)

Returns the value of attribute created_at.



12
13
14
# File 'lib/legion/extensions/agentic/social/perspective_shifting/helpers/perspective.rb', line 12

def created_at
  @created_at
end

#empathy_levelObject (readonly)

Returns the value of attribute empathy_level.



12
13
14
# File 'lib/legion/extensions/agentic/social/perspective_shifting/helpers/perspective.rb', line 12

def empathy_level
  @empathy_level
end

#expertise_domainsObject (readonly)

Returns the value of attribute expertise_domains.



12
13
14
# File 'lib/legion/extensions/agentic/social/perspective_shifting/helpers/perspective.rb', line 12

def expertise_domains
  @expertise_domains
end

#idObject (readonly)

Returns the value of attribute id.



12
13
14
# File 'lib/legion/extensions/agentic/social/perspective_shifting/helpers/perspective.rb', line 12

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/legion/extensions/agentic/social/perspective_shifting/helpers/perspective.rb', line 12

def name
  @name
end

#perspective_typeObject (readonly)

Returns the value of attribute perspective_type.



12
13
14
# File 'lib/legion/extensions/agentic/social/perspective_shifting/helpers/perspective.rb', line 12

def perspective_type
  @perspective_type
end

#prioritiesObject (readonly)

Returns the value of attribute priorities.



12
13
14
# File 'lib/legion/extensions/agentic/social/perspective_shifting/helpers/perspective.rb', line 12

def priorities
  @priorities
end

Instance Method Details

#to_hObject



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/legion/extensions/agentic/social/perspective_shifting/helpers/perspective.rb', line 27

def to_h
  {
    id:                @id,
    name:              @name,
    perspective_type:  @perspective_type,
    priorities:        @priorities,
    expertise_domains: @expertise_domains,
    empathy_level:     @empathy_level.round(10),
    bias_toward:       @bias_toward,
    created_at:        @created_at
  }
end