Sha256: 918763b1d2e25c4b4c2777eb68f8fa5ec8261404641d658290182c29f7df63dc
Contents?: true
Size: 949 Bytes
Versions: 1
Compression:
Stored size: 949 Bytes
Contents
module Unidom module Common ## # Neglection 根据配置信息忽略指定的类或者命名空间。 class Neglection ## # 判断指定的类名是否被忽略。如: # Unidom::Common::Neglection.namespace_neglected? 'Namespace::ClassName' # 在应用的 config/initializers/unidom.rb 文件中配置如下代码,即可忽略 Namespace::ClassName 这个类。 # Unidom::Common.configure do |options| # # The migrations inside the following namespaces will be ignored. The models inside the following namespaces won't be defined. # options[:neglected_namespaces] = %w{ # Namespace::ClassName # } def self.namespace_neglected?(class_name) neglected_namespaces = Unidom::Common.try(:options).try(:[], :neglected_namespaces) neglected_namespaces.present? ? neglected_namespaces.include?(class_name.to_s.deconstantize) : false end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unidom-common-3.0 | lib/unidom/common/neglection.rb |