module Bonita::Utils::MappingResolver

Private Instance Methods

child_mapper(deploy) click to toggle source
# File lib/bonita/utils.rb, line 29
def child_mapper(deploy)
  Object.const_get "#{namespace}::#{strip_prefix_and_suffix(deploy).capitalize}Mapping"
end
mapper() click to toggle source
# File lib/bonita/utils.rb, line 33
def mapper
  Object.const_get @resource.class.name.gsub('Resource', 'Mapping')
end
namespace() click to toggle source
# File lib/bonita/utils.rb, line 37
def namespace
  @resource.class.name.gsub(/::\w+Resource/, '')
end
strip_prefix_and_suffix(deploy) click to toggle source

Given the following input strings : foo_id fooId parent_foo_id This method will always return ‘foo’

# File lib/bonita/utils.rb, line 46
def strip_prefix_and_suffix(deploy)
  deploy.gsub(/Id|_id/, '').split('_')[-1]
end