Class: Meta::Scope

Inherits:
Object
  • Object
show all
Extended by:
Base
Defined in:
lib/meta/scope/base.rb,
lib/meta/scope/utils.rb

Defined Under Namespace

Modules: Base, Errors, Utils Classes: And, Composite, Or

Class Method Summary collapse

Methods included from Base

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

Class Method Details

.include(*mods) ⇒ Object



74
75
76
77
78
79
80
# File 'lib/meta/scope/base.rb', line 74

def include(*mods)
  scopes = mods.filter { |m| m < Meta::Scope }
  mods = mods - scopes

  include_scope(*scopes) if scopes.any?
  super(*mods) if mods.any?
end

.inherited(subclass) ⇒ Object



67
68
69
70
71
72
# File 'lib/meta/scope/base.rb', line 67

def inherited(subclass)
  # subclass.instance_variable_set(:@forwarded_scope, Or.new)

  # 如果是 Meta::Scope 的具体子类被继承,该子类加入到 @included_scopes 原语中
  subclass.include_scope(self) if self != Meta::Scope
end

.new(*args) ⇒ Object

Raises:

  • (NoMethodError)


63
64
65
# File 'lib/meta/scope/base.rb', line 63

def new(*args)
  raise NoMethodError, 'Meta::Scope 类不能实例化'
end