Sha256: 06b8bce942b51c47e21f716ba56879b0d6a7d8891ae06c80a703c352ae0b75b7
Contents?: true
Size: 638 Bytes
Versions: 70
Compression:
Stored size: 638 Bytes
Contents
module Avo module Fields class StatusField < BaseField def initialize(id, **args, &block) super(id, **args, &block) @loading_when = args[:loading_when].present? ? [args[:loading_when]].flatten.map(&:to_sym) : [:waiting, :running] @failed_when = args[:failed_when].present? ? [args[:failed_when]].flatten.map(&:to_sym) : [:failed] end def status status = "success" if value.present? status = "failed" if @failed_when.include? value.to_sym status = "loading" if @loading_when.include? value.to_sym end status end end end end
Version data entries
70 entries across 70 versions & 1 rubygems