Sha256: 1261cb67a8492eaa94837c7c4eb95ebf80a337fe9e2011b6c03431569823c971
Contents?: true
Size: 890 Bytes
Versions: 22
Compression:
Stored size: 890 Bytes
Contents
module Kuroko2 module Workflow module Task class TimeBase < Base class << self attr_reader :task_name def set_task_name(task_name) @task_name = task_name end end def execute if option.present? validate token.context[self.class.task_name] = to_minutes(option) end :next end def validate unless /\A\d+(?:h|m)?\z/ === option raise Workflow::AssertionError, "A value of #{self.class.task_name} should be a number." end end private def to_minutes(option) case option when /\A(\d+)h\z/ $1.to_i * 60 when /\A(\d+)m\z/ $1.to_i else option.to_i end end end end end end
Version data entries
22 entries across 22 versions & 1 rubygems