class Libis::Workflow::ActiveRecord::Workflow

Public Class Methods

from_hash(hash) click to toggle source
# File lib/libis/workflow/activerecord/workflow.rb, line 23
def self.from_hash(hash)
  self.create_from_hash(hash, [:name]) do |item, cfg|
    item.configure(cfg.merge('name' => item.name))
    cfg.clear
  end
end
load(file_or_hash) click to toggle source
# File lib/libis/workflow/activerecord/workflow.rb, line 30
def self.load(file_or_hash)
  config = Libis::Tools::ConfigFile.new
  config << file_or_hash
  return nil if config.empty?
  workflow = self.new
  workflow.configure(config.to_hash.key_symbols_to_strings(recursive: true))
  workflow
end