Class: ActiveAdmin::Scope

Inherits:
Object show all
Defined in:
lib/active_admin/scope.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, method = nil, &block) ⇒ Scope

Returns a new instance of Scope.



6
7
8
9
10
11
12
13
14
# File 'lib/active_admin/scope.rb', line 6

def initialize(name, method = nil, &block)
  @name = name.to_s.titleize
  @scope_method = method || name.to_sym
  @id = @name.gsub(' ', '').underscore
  if block_given?
    @scope_method = nil
    @scope_block = block
  end
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/active_admin/scope.rb', line 4

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/active_admin/scope.rb', line 4

def name
  @name
end

#scope_blockObject (readonly)

Returns the value of attribute scope_block.



4
5
6
# File 'lib/active_admin/scope.rb', line 4

def scope_block
  @scope_block
end

#scope_methodObject (readonly)

Returns the value of attribute scope_method.



4
5
6
# File 'lib/active_admin/scope.rb', line 4

def scope_method
  @scope_method
end