Class: Mistri::Skill

Inherits:
Data
  • Object
show all
Defined in:
lib/mistri/skill.rb

Overview

One expert playbook: a name the model selects by, a description that earns the selection, and the full body it reads before acting. Build them from anywhere — Skills.load reads a directory, and a host with skills in a database constructs these directly.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, description: "", body: "") ⇒ Skill

Returns a new instance of Skill.

Raises:



9
10
11
12
13
# File 'lib/mistri/skill.rb', line 9

def initialize(name:, description: "", body: "")
  raise ConfigurationError, "a skill needs a name" if name.to_s.empty?

  super(name: name.to_s, description: description.to_s, body: body.to_s)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body

Returns:

  • (Object)

    the current value of body



8
9
10
# File 'lib/mistri/skill.rb', line 8

def body
  @body
end

#descriptionObject (readonly)

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



8
9
10
# File 'lib/mistri/skill.rb', line 8

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



8
9
10
# File 'lib/mistri/skill.rb', line 8

def name
  @name
end