lib/boty/action_description.rb in boty-0.1.2 vs lib/boty/action_description.rb in boty-0.2.0

- old
+ new

@@ -1,5 +1,27 @@ module Boty + # Public: contains de descriptive information that was associated with an + # action via the `Bot#desc` method. + # + # Besides that also keep tracks of the regex for the associated Action, it is + # used to describe the handler in case no command name and/or description was + # passed via `Bot#desc`. + # + # The `ActionDescription` object will be stored inside the `Action#desc`. A + # good usage example can be found in the `scripts/knows.rb` script. + # + # Examples: + # + # # scripts/omg.rb + # desc "X omg!", "Make the bot scream X omgs." + # hear(/(\d+ )?omg!/i) do |how_many| + # how_many.times do say "LOL!" end + # end + # + # # => generates an action with a description like this: + # ActionDescription.new "X omg!", + # description: "Make the bot scream X omgs." + # regex: /(\d+ )?omg!/i class ActionDescription attr_reader :command, :description attr_writer :regex def initialize(command, description: nil, regex: nil)