Sha256: 4a83602b644ba162a50c59a58e3b0506d152237718fda934c6e32a409e069a24
Contents?: true
Size: 1 KB
Versions: 1
Compression:
Stored size: 1 KB
Contents
module Boty class Action attr_reader :regex, :desc, :action class Description attr_reader :command, :description attr_writer :regex def initialize(command, description: nil, regex: nil) if description.nil? @description = command else @command, @description = command, description end @regex = regex end def command return @command if @command match = /\?(i?)-(mx|mix):(.*)\)/.match @regex.to_s "/#{match[3]}/#{match[1]}" end end def initialize(regex, desc, &action) desc = Hash(desc) description = Description.new(desc[:command], description: desc[:description], regex: regex) @regex, @desc, @action = regex, description, action end def is_this?(regex, block) if block regex == self.regex && block == self.action else regex == self.regex end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
boty-0.0.13 | lib/boty/action.rb |