Class: DoubleEntry::Account::ActiveRecordScopeFactory
- Inherits:
-
Object
- Object
- DoubleEntry::Account::ActiveRecordScopeFactory
- Defined in:
- lib/double_entry/account.rb
Instance Method Summary collapse
-
#initialize(active_record_class) ⇒ ActiveRecordScopeFactory
constructor
A new instance of ActiveRecordScopeFactory.
- #scope_identifier ⇒ Object
Constructor Details
#initialize(active_record_class) ⇒ ActiveRecordScopeFactory
Returns a new instance of ActiveRecordScopeFactory.
53 54 55 |
# File 'lib/double_entry/account.rb', line 53 def initialize(active_record_class) @active_record_class = active_record_class end |
Instance Method Details
#scope_identifier ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/double_entry/account.rb', line 57 def scope_identifier lambda do |value| case value when @active_record_class value.id when String, Fixnum value else raise AccountScopeMismatchError.new("Expected instance of `#{@active_record_class}`, received instance of `#{value.class}`") end end end |