Class: Pragma::Contract::ModelFinder::ActiveRecord
- Inherits:
-
Base
- Object
- Base
- Pragma::Contract::ModelFinder::ActiveRecord
show all
- Defined in:
- lib/pragma/contract/model_finder/active_record.rb
Instance Attribute Summary
Attributes inherited from Base
#klass, #options
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Class Method Details
.supports?(klass) ⇒ Boolean
8
9
10
|
# File 'lib/pragma/contract/model_finder/active_record.rb', line 8
def supports?(klass)
defined?(::ActiveRecord::Base) && klass < ::ActiveRecord::Base
end
|
Instance Method Details
#find(value) ⇒ Object
13
14
15
|
# File 'lib/pragma/contract/model_finder/active_record.rb', line 13
def find(value)
klass.find_by(options[:by] => value)
end
|