Module: ActiveRecordPolytypeInterceptors::ClassMethods

Defined in:
lib/activerecord-polytypes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#enum_indexObject

Returns the value of attribute enum_index.



390
391
392
# File 'lib/activerecord-polytypes.rb', line 390

def enum_index
  @enum_index
end

#scope_indexObject

Returns the value of attribute scope_index.



390
391
392
# File 'lib/activerecord-polytypes.rb', line 390

def scope_index
  @scope_index
end

Instance Method Details

#enum(*args, **kwargs, &blk) ⇒ Object



392
393
394
395
396
397
# File 'lib/activerecord-polytypes.rb', line 392

def enum(*args, **kwargs, &blk)
  @enum_index ||= []
  @enum_index << [args.deep_dup, kwargs.deep_dup, blk]
  puts "Defining enum: #{args} #{kwargs} #{blk} for #{self.name}. #{@enum_index}"
  super
end

#scope(*args, **kwargs, &blk) ⇒ Object



399
400
401
402
403
# File 'lib/activerecord-polytypes.rb', line 399

def scope(*args, **kwargs, &blk)
  @scope_index ||= []
  @scope_index << [args.dup, kwargs.dup, blk]
  super
end