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



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

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

  @obj.resources_for_type(type)
end

#fallback_dataObject



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

def fallback_data
  {}
end

#key?(type) ⇒ Boolean

Returns:

  • (Boolean)


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

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