Class: RansackWrap::Scopes
- Inherits:
-
Object
- Object
- RansackWrap::Scopes
- Includes:
- ActiveAttr::TypecastedAttributes
- Defined in:
- lib/ransack_wrap/scopes.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #attribute_method?(attr_name) ⇒ Boolean
-
#initialize(object) ⇒ Scopes
constructor
A new instance of Scopes.
- #scoped ⇒ Object
- #try_scope(name, args) ⇒ Object
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
#object ⇒ Object (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
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 |
#scoped ⇒ Object
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 |