Class: Unidom::Common::Neglection
- Inherits:
-
Object
- Object
- Unidom::Common::Neglection
- Defined in:
- lib/unidom/common/neglection.rb
Overview
Neglection 根据配置信息忽略指定的类或者命名空间。
Class Method Summary collapse
-
.namespace_neglected?(class_name) ⇒ Boolean
判断指定的类名是否被忽略。如: 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.
Class Method Details
.namespace_neglected?(class_name) ⇒ Boolean
判断指定的类名是否被忽略。如: 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 = %w
Namespace::ClassName
17 18 19 20 |
# File 'lib/unidom/common/neglection.rb', line 17 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 |