Sha256: 7ebfd8d3e145238359a87195ad120a95e60c1829f45ddbbc6401d3e1cf9f2c40

Contents?: true

Size: 740 Bytes

Versions: 13

Compression:

Stored size: 740 Bytes

Contents

module Maestrano::Connector::Rails
  module EntityHelper
    def self.snake_name(entity)
      class_name = entity.class.name.underscore.split('/').last
      if entity.is_a?(Maestrano::Connector::Rails::SubEntityBase)
        name = ''
        Entities.constants&.each do |c|
          klass = Entities.const_get(c)
          next unless klass.respond_to?(:formatted_external_entities_names)
          if klass.formatted_external_entities_names.values.include?(class_name.camelize) ||
             klass.formatted_connec_entities_names.values.include?(class_name.camelize)
            name = c
            break
          end
        end
        name.to_s.underscore.to_sym
      else
        class_name.to_sym
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
maestrano-connector-rails-2.1.0 app/helpers/maestrano/connector/rails/entity_helper.rb
maestrano-connector-rails-2.0.2.pre.RC12 app/helpers/maestrano/connector/rails/entity_helper.rb
maestrano-connector-rails-2.0.2.pre.RC11 app/helpers/maestrano/connector/rails/entity_helper.rb
maestrano-connector-rails-2.0.2.pre.RC10 app/helpers/maestrano/connector/rails/entity_helper.rb
maestrano-connector-rails-2.0.2.pre.RC8 app/helpers/maestrano/connector/rails/entity_helper.rb
maestrano-connector-rails-2.0.2.pre.RC9 app/helpers/maestrano/connector/rails/entity_helper.rb
maestrano-connector-rails-2.0.2.pre.RC7 app/helpers/maestrano/connector/rails/entity_helper.rb
maestrano-connector-rails-2.0.2.pre.RC6 app/helpers/maestrano/connector/rails/entity_helper.rb
maestrano-connector-rails-2.0.2.pre.RC5 app/helpers/maestrano/connector/rails/entity_helper.rb
maestrano-connector-rails-2.0.2.pre.RC4 app/helpers/maestrano/connector/rails/entity_helper.rb
maestrano-connector-rails-2.0.2.pre.RC3 app/helpers/maestrano/connector/rails/entity_helper.rb
maestrano-connector-rails-2.0.2.pre.RC2 app/helpers/maestrano/connector/rails/entity_helper.rb
maestrano-connector-rails-2.0.2.pre.RC1 app/helpers/maestrano/connector/rails/entity_helper.rb