Class: Plutonium::Query::ModelScope

Inherits:
Base
  • Object
show all
Defined in:
lib/plutonium/query/model_scope.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Definition::Presentable

#description, #icon, #label

Constructor Details

#initialize(name) ⇒ ModelScope

Initializes a ModelScope with a given name.

Parameters:

  • name (Symbol)

    The name of the scope.



9
10
11
12
# File 'lib/plutonium/query/model_scope.rb', line 9

def initialize(name)
  super()
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/plutonium/query/model_scope.rb', line 4

def name
  @name
end

Instance Method Details

#apply(scope) ⇒ Object



14
15
16
# File 'lib/plutonium/query/model_scope.rb', line 14

def apply(scope, **)
  scope.public_send(name, **)
end