Sha256: 6339b23cada7a482f5072253a7b9aa4abbe138c5aecbf8003393826e6b877829
Contents?: true
Size: 1.41 KB
Versions: 4
Compression:
Stored size: 1.41 KB
Contents
module Faalis module Workflows # Base class for all the workflows in a `Faalis application` class Base attr_reader :id @@default_values = {:title => self.class.to_s.underscore, :icon => nil, :image => nil, :permissions => []} def initialize(model_instance) @id = model_instance.id end # class method to set the title of current workflow def self.title(name) define_method :title do name || self.to_s.underscore end end # Set the current workflow icon if any def self.icon(icon) define_method :icon do icon end end def icon? return true if defined? :icon false end # Set the current workflow image if any def self.image(image) define_method :image do image end end def image? return true if defined? :image false end # Use this class method to add any permission that is neeeded # for this workflow to work def self.permissions(*args) define_method :permissions do args || [] end end def method_missing(m, *args, &block) if @@default_values.include? m @@default_values[m] else super end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
faalis-0.26.3 | lib/faalis/workflows/base.rb |
faalis-0.26.2 | lib/faalis/workflows/base.rb |
faalis-0.26.1 | lib/faalis/workflows/base.rb |
faalis-0.26.0 | lib/faalis/workflows/base.rb |