Class: RansackWrap::Scopes

Inherits:
Object
  • Object
show all
Includes:
ActiveAttr::TypecastedAttributes
Defined in:
lib/ransack_wrap/scopes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ Scopes

Returns a new instance of Scopes.



6
7
8
# File 'lib/ransack_wrap/scopes.rb', line 6

def initialize(object)
  @object = object
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



4
5
6
# File 'lib/ransack_wrap/scopes.rb', line 4

def object
  @object
end

Instance Method Details

#attribute_method?(attr_name) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/ransack_wrap/scopes.rb', line 14

def attribute_method?(attr_name)
  respond_to_without_attributes?(:attributes) && attr_name.in?(attributes)
end

#scopedObject



10
11
12
# File 'lib/ransack_wrap/scopes.rb', line 10

def scoped
  object.scoped
end

#try_scope(name, args) ⇒ Object



18
19
20
21
# File 'lib/ransack_wrap/scopes.rb', line 18

def try_scope(name, args)
  return unless args.present?
  self.try "scope_#{name}", args
end