Class: Counter::Cache::Counters::BufferCounter::RelationFinder

Inherits:
Struct
  • Object
show all
Defined in:
lib/counter/cache/counters/buffer_counter/relation_finder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



5
6
7
# File 'lib/counter/cache/counters/buffer_counter/relation_finder.rb', line 5

def options
  @options
end

#source_objectObject

Returns the value of attribute source_object

Returns:

  • (Object)

    the current value of source_object



5
6
7
# File 'lib/counter/cache/counters/buffer_counter/relation_finder.rb', line 5

def source_object
  @source_object
end

Instance Method Details

#relation_classObject



6
7
8
9
10
# File 'lib/counter/cache/counters/buffer_counter/relation_finder.rb', line 6

def relation_class
  return options.relation_class_name if options.relation_class_name
  return polymorphic_type if options.polymorphic?
  reflection_type
end

#relation_idObject



12
13
14
# File 'lib/counter/cache/counters/buffer_counter/relation_finder.rb', line 12

def relation_id
  options.relation_id || source_object.send("#{options.relation}_id")
end