Module: Surrealist::Helper
- Defined in:
- lib/surrealist/helper.rb
Overview
A generic helper.
Class Method Summary collapse
- .collection?(object) ⇒ Boolean
-
.surrealist?(klass) ⇒ Boolean
Determines if the class uses the Surrealist mixin.
Class Method Details
.collection?(object) ⇒ Boolean
15 16 17 18 19 20 |
# File 'lib/surrealist/helper.rb', line 15 def self.collection?(object) # 4.2 AR relation object did not include Enumerable (it defined # all necessary method through ActiveRecord::Delegation module), # so we need to explicitly check for this (object.is_a?(Enumerable) && !object.instance_of?(Hash)) || ar_relation?(object) end |
.surrealist?(klass) ⇒ Boolean
Determines if the class uses the Surrealist mixin.
11 12 13 |
# File 'lib/surrealist/helper.rb', line 11 def self.surrealist?(klass) klass < Surrealist || klass < Surrealist::Serializer end |