Module: Bumbleworks::Entity::ClassMethods

Defined in:
lib/bumbleworks/entity.rb

Instance Method Summary collapse

Instance Method Details

#default_process_identifier_attribute(process_name) ⇒ Object



114
115
116
117
118
119
# File 'lib/bumbleworks/entity.rb', line 114

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



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

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

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



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

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

#processesObject



106
107
108
# File 'lib/bumbleworks/entity.rb', line 106

def processes
  @processes ||= {}
end