Class: PodcastIndex::Value
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- PodcastIndex::Value
- Defined in:
- lib/podcast_index/value.rb
Constant Summary collapse
- FIND_ONE_ATTRIBUTES =
%i[feed_id feed_url].freeze
Class Method Summary collapse
Class Method Details
.find_by(attributes) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/podcast_index/value.rb', line 9 def find_by(attributes) match = (attributes.keys & FIND_ONE_ATTRIBUTES) raise ArgumentError, "Must supply one of the attributes: #{FIND_ONE_ATTRIBUTES}" unless match.present? raise ArgumentError, "Must supply only one of the attributes: #{FIND_ONE_ATTRIBUTES}" if match.length > 1 send("find_by_#{match.first}", attributes[match.first]) end |