class ActionCommand::LogMessage
A single entry in the action command log
Attributes
cmd[RW]
key[RW]
kind[RW]
msg[RW]
sequence[RW]
Public Instance Methods
command?(cmd)
click to toggle source
@return true if the cmds equal (tolerant of being passed a class)
# File lib/action_command/log_parser.rb, line 47 def command?(cmd) cmd = cmd.name if cmd.is_a? Class return @cmd == cmd end
depth()
click to toggle source
@return the number of parents the current command has
# File lib/action_command/log_parser.rb, line 22 def depth return @depth end
key?(key)
click to toggle source
# File lib/action_command/log_parser.rb, line 36 def key?(key) return @key == key end
kind?(kind)
click to toggle source
@return true if the kinds equal (tolerant of string/symbol mismatch)
# File lib/action_command/log_parser.rb, line 41 def kind?(kind) kind = kind.to_s return @kind == kind end
line()
click to toggle source
@return the line that was used to create this message.
# File lib/action_command/log_parser.rb, line 32 def line return @line end
match_message?(msg)
click to toggle source
@ return true if msgs equal
# File lib/action_command/log_parser.rb, line 53 def match_message?(msg) return @msg == msg unless msg.is_a? Hash msg.each do |k, v| k = k.to_s if k.is_a? Symbol return false unless @msg.key?(k) return false unless @msg[k] == v end return true end
populate(line, msg)
click to toggle source
Create a new log message
# File lib/action_command/log_parser.rb, line 11 def populate(line, msg) @line = line @sequence = msg['sequence'] @depth = msg['depth'] @cmd = msg['cmd'] @kind = msg['kind'] @msg = msg['msg'] @key = msg['key'] end
root?()
click to toggle source
@return true if this command is the root command
# File lib/action_command/log_parser.rb, line 27 def root? return @depth == 0 end