Class: ActsAsCalculator::FindOwnedRecord
- Inherits:
-
Object
- Object
- ActsAsCalculator::FindOwnedRecord
- Defined in:
- lib/acts_as_calculator/find_owned_record.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(relation:, key:, scope: nil, owner: nil) ⇒ FindOwnedRecord
constructor
A new instance of FindOwnedRecord.
Constructor Details
#initialize(relation:, key:, scope: nil, owner: nil) ⇒ FindOwnedRecord
Returns a new instance of FindOwnedRecord.
9 10 11 12 13 14 |
# File 'lib/acts_as_calculator/find_owned_record.rb', line 9 def initialize(relation:, key:, scope: nil, owner: nil) @relation = relation @key = key.to_s @scope = (scope || DEFAULT_SCOPE).to_s @owner = owner end |
Class Method Details
.call ⇒ Object
5 6 7 |
# File 'lib/acts_as_calculator/find_owned_record.rb', line 5 def self.call(...) new(...).call end |
Instance Method Details
#call ⇒ Object
16 17 18 |
# File 'lib/acts_as_calculator/find_owned_record.rb', line 16 def call owned || global end |