Sha256: d66fea234bac0ea117556bc6207c19906a1acbd6fba540a14e1f2d917adcc606
Contents?: true
Size: 957 Bytes
Versions: 17
Compression:
Stored size: 957 Bytes
Contents
module Aio::Parse class HasDeviceState < ParentState def get_device(opts) self.device_manager.add_device(opts) end def get_full(opts) if ! check_full(opts) no_full elsif @machine.to_full_state end end def no_full end # 验证是否有cmd和context了 def check_full(opts={}) device_name = opts[:device_name] device_klass = self.device_manager.devices[device_name] org_cmd = opts[:cmd] org_context = opts[:context] org_cmd_reg = Aio::Base::Toolkit::Regexp.to_reg(org_cmd) device_klass.cmds_context.each_pair do |cmd, context| # 只有当有cmd, 并且context不为空的时候才算有 # FIXME 可以在这里的context类加入.check_avlid? 查看是否有效 if org_cmd_reg.match(cmd) if ! context.empty? return true end end end return false end end end
Version data entries
17 entries across 17 versions & 1 rubygems