Class: Evento::Extractor
- Inherits:
-
Object
- Object
- Evento::Extractor
- Defined in:
- lib/evento/extractor.rb
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
Instance Method Summary collapse
- #extract_audit_trail_association(options = {}) ⇒ Object
- #extract_events(options = {}) ⇒ Object
- #extract_transaction_log_association ⇒ Object
-
#initialize(klass) ⇒ Extractor
constructor
A new instance of Extractor.
Constructor Details
#initialize(klass) ⇒ Extractor
Returns a new instance of Extractor.
7 8 9 |
# File 'lib/evento/extractor.rb', line 7 def initialize(klass) @klass = klass end |
Instance Attribute Details
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
5 6 7 |
# File 'lib/evento/extractor.rb', line 5 def klass @klass end |
Instance Method Details
#extract_audit_trail_association(options = {}) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/evento/extractor.rb', line 17 def extract_audit_trail_association( = {}) name = ([:name] || :resource_state_transitions).to_sym reflection = extract_association_reflection(klass, name) return reflection if [:reflection] reflection&.klass end |
#extract_events(options = {}) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/evento/extractor.rb', line 26 def extract_events( = {}) events = [] events += events_from_state_machine.map(&:to_s) if [:state_machine] events += events_from_devise if [:devise] events.sort end |
#extract_transaction_log_association ⇒ Object
11 12 13 14 15 |
# File 'lib/evento/extractor.rb', line 11 def extract_transaction_log_association reflection = extract_association_reflection(klass, :transaction_log_entries) reflection&.klass end |