Sha256: 8a4163c147b406277a4b83853d50ac73fd0e7e19c83ded7371b4d18c70a62d80

Contents?: true

Size: 1.84 KB

Versions: 105

Compression:

Stored size: 1.84 KB

Contents

require 'forest_liana/engine'

module Forest
end

module ForestLiana

  autoload :MixpanelEvent, 'forest_liana/mixpanel_event'

  module UserSpace
  end

  # NOTICE: Deprecated secret value names
  mattr_accessor :secret_key
  mattr_accessor :auth_key

  mattr_accessor :env_secret
  mattr_accessor :auth_secret
  mattr_accessor :forest_client_id
  mattr_accessor :application_url
  mattr_accessor :integrations
  mattr_accessor :apimap
  mattr_accessor :allowed_users
  mattr_accessor :models
  mattr_accessor :excluded_models
  mattr_accessor :included_models
  mattr_accessor :user_class_name
  mattr_accessor :names_overriden
  mattr_accessor :meta
  mattr_accessor :logger
  mattr_accessor :reporter
  # TODO: Remove once lianas prior to 2.0.0 are not supported anymore.
  mattr_accessor :names_old_overriden

  self.apimap = []
  self.allowed_users = []
  self.models = []
  self.excluded_models = []
  self.included_models = []
  self.user_class_name = nil
  self.names_overriden = {}
  self.meta = {}
  self.logger = nil
  self.reporter = nil

  @config_dir = 'lib/forest_liana/**/*.rb'

  # TODO: Remove once lianas prior to 2.0.0 are not supported anymore.
  self.names_old_overriden = {}

  def self.config_dir=(config_dir)
    @config_dir = config_dir
  end

  def self.config_dir
    Rails.root.join(@config_dir)
  end

  def self.schema_for_resource resource
    self.apimap.find do |collection|
      SchemaUtils.find_model_from_collection_name(collection.name)
        .try(:name) == resource.name
    end
  end

  def self.name_for(model)
    self.names_overriden[model] || model.try(:name).gsub('::', '__')
  end

  # TODO: Remove once lianas prior to 2.0.0 are not supported anymore.
  def self.name_old_for(model)
    self.names_old_overriden[model] || model.try(:table_name)
  end

  def self.component_prefix(model)
    self.name_for(model).classify
  end
end

Version data entries

105 entries across 105 versions & 1 rubygems

Version Path
forest_liana-9.3.13 lib/forest_liana.rb
forest_liana-9.3.12 lib/forest_liana.rb
forest_liana-9.3.11 lib/forest_liana.rb
forest_liana-9.3.10 lib/forest_liana.rb
forest_liana-9.3.9 lib/forest_liana.rb
forest_liana-9.3.8 lib/forest_liana.rb
forest_liana-9.3.7 lib/forest_liana.rb
forest_liana-9.3.6 lib/forest_liana.rb
forest_liana-9.3.3 lib/forest_liana.rb
forest_liana-9.3.2 lib/forest_liana.rb
forest_liana-8.3.1 lib/forest_liana.rb
forest_liana-9.3.1 lib/forest_liana.rb
forest_liana-9.3.0 lib/forest_liana.rb
forest_liana-8.3.0 lib/forest_liana.rb
forest_liana-9.2.3 lib/forest_liana.rb
forest_liana-9.2.2 lib/forest_liana.rb
forest_liana-9.2.1 lib/forest_liana.rb
forest_liana-9.2.0 lib/forest_liana.rb
forest_liana-9.1.10 lib/forest_liana.rb
forest_liana-9.1.9 lib/forest_liana.rb