Sha256: 01ed6e650b25db3079bf4c9e5ca3680e7b62eee89c677919e983970c09520fc9

Contents?: true

Size: 741 Bytes

Versions: 1

Compression:

Stored size: 741 Bytes

Contents

# frozen_string_literal: true

require_relative 'plugin'

module Ego
  # A capability defines functionality added to a `Robot` instance by a
  # plug-in.
  #
  # @note New capabilities should be specified by plug-ins using the
  #   `Robot#can` method.
  #
  # @example Add a capability to the robot instance
  #   Ego.plugin do |robot|
  #     robot.can 'repeat what you say'
  #     # ...
  #   end
  #
  # @see Robot#can
  class Capability
    attr_reader :desc, :plugin

    # @param desc [String] the capability description answering "What can the robot do?"
    def initialize(desc)
      @desc = desc
      @plugin = Plugin.context
    end

    # @return [String] the capability description
    def to_s
      @desc
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ego-0.6.0 lib/ego/capability.rb