Module: Bumbleworks::Entity::ClassMethods

Defined in:
lib/bumbleworks/entity.rb

Instance Method Summary collapse

Instance Method Details

#default_process_identifier_attribute(process_name) ⇒ Object



107
108
109
110
111
112
# File 'lib/bumbleworks/entity.rb', line 107

def default_process_identifier_attribute(process_name)
  identifier_attribute = "#{process_name}_process_identifier"
  identifier_attribute.gsub!(/^#{entity_type}_/, '')
  identifier_attribute.gsub!(/process_process/, 'process')
  identifier_attribute.to_sym
end

#entity_typeObject



103
104
105
# File 'lib/bumbleworks/entity.rb', line 103

def entity_type
  Bumbleworks::Support.tokenize(name)
end

#process(process_name, options = {}) ⇒ Object



94
95
96
97
# File 'lib/bumbleworks/entity.rb', line 94

def process(process_name, options = {})
  options[:attribute] ||= default_process_identifier_attribute(process_name)
  processes[process_name.to_sym] = options
end

#processesObject



99
100
101
# File 'lib/bumbleworks/entity.rb', line 99

def processes
  @processes ||= {}
end