Module: Granite::Form::Model::Scopes::ClassMethods

Defined in:
lib/granite/form/model/scopes.rb

Instance Method Summary collapse

Instance Method Details

#current_scopeObject



111
112
113
# File 'lib/granite/form/model/scopes.rb', line 111

def current_scope
  @current_scope ||= scope_class.new
end

#current_scope=(value) ⇒ Object



107
108
109
# File 'lib/granite/form/model/scopes.rb', line 107

def current_scope=(value)
  @current_scope = value
end

#scope(*args) ⇒ Object



99
100
101
102
103
104
105
# File 'lib/granite/form/model/scopes.rb', line 99

def scope(*args)
  if args.empty?
    current_scope
  else
    scope_class.new(*args)
  end
end

#scope_classObject



95
96
97
# File 'lib/granite/form/model/scopes.rb', line 95

def scope_class
  @scope_class ||= Granite::Form::Model::Scopes::ScopeProxy.for(self)
end

#scopify(scope_base = Array) ⇒ Object



91
92
93
# File 'lib/granite/form/model/scopes.rb', line 91

def scopify(scope_base = Array)
  self._scope_base = scope_base
end