Class: Bridgetown::Drops::RelationsDrop

Inherits:
Drop
  • Object
show all
Defined in:
bridgetown-core/lib/bridgetown-core/drops/relations_drop.rb

Constant Summary

Constants inherited from Drop

Drop::NON_CONTENT_METHODS

Instance Method Summary collapse

Methods inherited from Drop

#[]=, #content_methods, #each, #each_key, #fetch, #hash_for_json, #initialize, #inspect, #keys, #merge, #merge!, mutable, mutable?, #to_h, #to_json

Constructor Details

This class inherits a constructor from Bridgetown::Drops::Drop

Instance Method Details

#[](type) ⇒ Object



8
9
10
11
12
# File 'bridgetown-core/lib/bridgetown-core/drops/relations_drop.rb', line 8

def [](type)
  return nil unless type.to_s.in?(@obj.relation_types)

  @obj.resources_for_type(type)
end

#fallback_dataObject



18
19
20
# File 'bridgetown-core/lib/bridgetown-core/drops/relations_drop.rb', line 18

def fallback_data
  {}
end

#key?(type) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'bridgetown-core/lib/bridgetown-core/drops/relations_drop.rb', line 14

def key?(type)
  type.to_s.in?(@obj.relation_types)
end