Class: Meta::Scope::Or
- Includes:
- Base
- Defined in:
- lib/meta/scope/base.rb
Overview
另一种 Scope 实例,用于表示多个 Scope 的逻辑 Or 操作
Instance Method Summary collapse
-
#match_scopes?(scopes) ⇒ Boolean
scopes 只需要包含一个 @scopes.
-
#scope_name ⇒ Object
重定义 scope_name,如果用得上的话.
Methods included from Base
#and, #defined_scopes, #include_scope, #inspect, #match?, #or, #scope_name=
Methods inherited from Composite
concat, #defined_scopes, #initialize, new
Constructor Details
This class inherits a constructor from Meta::Scope::Composite
Instance Method Details
#match_scopes?(scopes) ⇒ Boolean
scopes 只需要包含一个 @scopes
142 143 144 |
# File 'lib/meta/scope/base.rb', line 142 def match_scopes?(scopes) @scopes.any? { |scope| scope.match?(scopes) } end |
#scope_name ⇒ Object
重定义 scope_name,如果用得上的话
147 148 149 |
# File 'lib/meta/scope/base.rb', line 147 def scope_name @scope_name || @scopes.map(&:scope_name).sort.join('_or_') end |