Class: Meta::Scope::And

Inherits:
Composite show all
Defined in:
lib/meta/scope/base.rb

Overview

逻辑 And 操作

Instance Method Summary collapse

Methods inherited from Composite

concat, #defined_scopes, #initialize, new

Methods included from Base

#and, #defined_scopes, #include_scope, #inspect, #match?, #or, #scope_name=

Constructor Details

This class inherits a constructor from Meta::Scope::Composite

Instance Method Details

#match_scopes?(scopes) ⇒ Boolean

scopes 需要包含所有的 @scopes

Returns:

  • (Boolean)


127
128
129
# File 'lib/meta/scope/base.rb', line 127

def match_scopes?(scopes)
  @scopes.all? { |scope| scope.match?(scopes) }
end

#scope_nameObject

重定义 scope_name,如果用得上的话



132
133
134
# File 'lib/meta/scope/base.rb', line 132

def scope_name
  @scope_name || @scopes.map(&:scope_name).sort.join('_and_')
end