Class: KairosMcp::EvolveContext
- Inherits:
-
Object
- Object
- KairosMcp::EvolveContext
- Defined in:
- lib/kairos_mcp/skill_contexts.rb
Overview
Evolve block context
Instance Attribute Summary collapse
-
#allowed ⇒ Object
readonly
Returns the value of attribute allowed.
-
#conditions ⇒ Object
readonly
Returns the value of attribute conditions.
-
#denied ⇒ Object
readonly
Returns the value of attribute denied.
-
#skill_id ⇒ Object
readonly
Returns the value of attribute skill_id.
Instance Method Summary collapse
- #allow(*fields) ⇒ Object
- #can_evolve?(field) ⇒ Boolean
- #deny(*fields) ⇒ Object
-
#initialize(skill_id) ⇒ EvolveContext
constructor
A new instance of EvolveContext.
- #to_h ⇒ Object
- #when_condition(name, &block) ⇒ Object
Constructor Details
#initialize(skill_id) ⇒ EvolveContext
Returns a new instance of EvolveContext.
189 190 191 192 193 194 |
# File 'lib/kairos_mcp/skill_contexts.rb', line 189 def initialize(skill_id) @skill_id = skill_id @allowed = [] @denied = [] @conditions = {} end |
Instance Attribute Details
#allowed ⇒ Object (readonly)
Returns the value of attribute allowed.
187 188 189 |
# File 'lib/kairos_mcp/skill_contexts.rb', line 187 def allowed @allowed end |
#conditions ⇒ Object (readonly)
Returns the value of attribute conditions.
187 188 189 |
# File 'lib/kairos_mcp/skill_contexts.rb', line 187 def conditions @conditions end |
#denied ⇒ Object (readonly)
Returns the value of attribute denied.
187 188 189 |
# File 'lib/kairos_mcp/skill_contexts.rb', line 187 def denied @denied end |
#skill_id ⇒ Object (readonly)
Returns the value of attribute skill_id.
187 188 189 |
# File 'lib/kairos_mcp/skill_contexts.rb', line 187 def skill_id @skill_id end |
Instance Method Details
#allow(*fields) ⇒ Object
196 197 198 |
# File 'lib/kairos_mcp/skill_contexts.rb', line 196 def allow(*fields) @allowed.concat(fields) end |
#can_evolve?(field) ⇒ Boolean
208 209 210 211 |
# File 'lib/kairos_mcp/skill_contexts.rb', line 208 def can_evolve?(field) return false if @denied.include?(field.to_sym) || @denied.include?(:all) @allowed.empty? || @allowed.include?(field.to_sym) end |
#deny(*fields) ⇒ Object
200 201 202 |
# File 'lib/kairos_mcp/skill_contexts.rb', line 200 def deny(*fields) @denied.concat(fields) end |
#to_h ⇒ Object
213 214 215 216 217 218 219 220 |
# File 'lib/kairos_mcp/skill_contexts.rb', line 213 def to_h { skill_id: @skill_id, allowed: @allowed, denied: @denied, conditions: @conditions.keys } end |
#when_condition(name, &block) ⇒ Object
204 205 206 |
# File 'lib/kairos_mcp/skill_contexts.rb', line 204 def when_condition(name, &block) @conditions[name] = block end |