Module: LedgerSync::Ledgers::Operation::Mixin::ClassMethods

Defined in:
lib/ledger_sync/ledgers/operation.rb

Instance Method Summary collapse

Instance Method Details

#client_classObject



8
9
10
# File 'lib/ledger_sync/ledgers/operation.rb', line 8

def client_class
  @client_class ||= Class.const_get("#{name.split('::')[0..2].join('::')}::Ledger")
end

#inherited(base) ⇒ Object



12
13
14
15
16
# File 'lib/ledger_sync/ledgers/operation.rb', line 12

def inherited(base)
  base.inferred_resource_class.operations[base.operation_method] = base

  super
end

#operation_methodObject



18
19
20
# File 'lib/ledger_sync/ledgers/operation.rb', line 18

def operation_method
  @operation_method ||= name.split('::').last.underscore.to_sym
end

#operations_moduleObject



22
23
24
# File 'lib/ledger_sync/ledgers/operation.rb', line 22

def operations_module
  @operations_module ||= Object.const_get("#{name.split('::Operations::').first}::Operations")
end