Class: KairosMcp::EvolveContext

Inherits:
Object
  • Object
show all
Defined in:
lib/kairos_mcp/skill_contexts.rb

Overview

Evolve block context

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#allowedObject (readonly)

Returns the value of attribute allowed.



187
188
189
# File 'lib/kairos_mcp/skill_contexts.rb', line 187

def allowed
  @allowed
end

#conditionsObject (readonly)

Returns the value of attribute conditions.



187
188
189
# File 'lib/kairos_mcp/skill_contexts.rb', line 187

def conditions
  @conditions
end

#deniedObject (readonly)

Returns the value of attribute denied.



187
188
189
# File 'lib/kairos_mcp/skill_contexts.rb', line 187

def denied
  @denied
end

#skill_idObject (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

Returns:

  • (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_hObject



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