class Aio::Module::InputStyle::Console::CmdState
Public Instance Methods
parse_line(line)
click to toggle source
# File lib/modules/input/style/console.rb, line 121 def parse_line(line) # 判断是不是cmd命令行 res = /^[\[|<]?(?<name>[^\s]*)(#|>|\])(?<cmd>.*)/.match(line) if res.nil? @machine.to_empty_state return end # 当已经发现了是cmd行,那么紧接下来就是收集文本内容 cmd_context.device_name = res[:name] cmd_context.cmd = res[:cmd].strip @machine.to_context_state end