class MGit::OperationProgressContext
本类用于缓存/加载操作中间态
Constants
- CONTEXT_BRANCH
- CONTEXT_CMD
现场信息关键字段
- CONTEXT_OPTS
- CONTEXT_OTHER
- CONTEXT_REPOS
Attributes
branch[RW]
cmd[RW]
opts[RW]
other[RW]
repos[RW]
type[RW]
Public Class Methods
new(type)
click to toggle source
# File lib/m-git/foundation/operation_progress_manager.rb, line 21 def initialize(type) self.type = type self.other = {} end
Public Instance Methods
deserialize(dict)
click to toggle source
反序列化
@param dict [Hash] 中间态Hash
# File lib/m-git/foundation/operation_progress_manager.rb, line 41 def deserialize(dict) self.cmd = dict[CONTEXT_CMD] self.opts = dict[CONTEXT_OPTS] self.branch = dict[CONTEXT_BRANCH] self.repos = dict[CONTEXT_REPOS] self.other = dict[CONTEXT_OTHER] end
serialize()
click to toggle source
将中间态对象序列化为Hash
# File lib/m-git/foundation/operation_progress_manager.rb, line 27 def serialize return { CONTEXT_CMD => self.cmd, CONTEXT_OPTS => self.opts, CONTEXT_BRANCH => self.branch, CONTEXT_REPOS => self.repos, CONTEXT_OTHER => self.other } end
validate?()
click to toggle source
校验中间态是否合法,仓库可缺省,若缺省则表示所有仓库
@return [Boolean] 是否合法
# File lib/m-git/foundation/operation_progress_manager.rb, line 53 def validate? return !self.cmd.nil? && !self.opts.nil? && !self.branch.nil? end