Module: Bumbleworks::Entity::ClassMethods

Defined in:
lib/bumbleworks/entity.rb

Instance Method Summary collapse

Instance Method Details

#default_process_identifier_attribute(process_name) ⇒ Object



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

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



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

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

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



87
88
89
90
# File 'lib/bumbleworks/entity.rb', line 87

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

#processesObject



92
93
94
# File 'lib/bumbleworks/entity.rb', line 92

def processes
  @processes ||= {}
end