Module: Shared::Conveyances
- Extended by:
- ActiveSupport::Concern
- Included in:
- CollectingEvent, CollectionObject, FieldOccurrence, Otu
- Defined in:
- app/models/concerns/shared/conveyances.rb
Overview
Shared code for extending data-classes with Conveyances (sounds).
TODO: Copy/pasta from Depictions. confirm
Instance Method Summary collapse
- #has_conveyances? ⇒ Boolean
- #reject_conveyances(attributed) ⇒ Object protected
- #reject_sounds(attributed) ⇒ Object protected
- #sound_array=(sounds) ⇒ Object
Instance Method Details
#has_conveyances? ⇒ Boolean
22 23 24 |
# File 'app/models/concerns/shared/conveyances.rb', line 22 def has_conveyances? self.conveyances.size > 0 end |
#reject_conveyances(attributed) ⇒ Object (protected)
32 33 34 |
# File 'app/models/concerns/shared/conveyances.rb', line 32 def reject_conveyances(attributed) attributed['sound_id'].blank? && !attributed['sounds_attributes'].nil? end |
#reject_sounds(attributed) ⇒ Object (protected)
36 37 38 |
# File 'app/models/concerns/shared/conveyances.rb', line 36 def reject_sounds(attributed) attributed['sound_file'].blank? end |
#sound_array=(sounds) ⇒ Object
26 27 28 |
# File 'app/models/concerns/shared/conveyances.rb', line 26 def sound_array=(sounds) self.conveyances_attributes = sounds.collect{|i, file| { sound_attributes: {sound_file: file}}} end |