Module: PolymorphicHelper

Included in:
StoreModel::Types::ManyPolymorphic, StoreModel::Types::OnePolymorphic
Defined in:
lib/store_model/types/polymorphic_helper.rb

Overview

Shared methods for polymorphic classes

Instance Method Summary collapse

Instance Method Details

#implements_model?(klass) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/store_model/types/polymorphic_helper.rb', line 10

def implements_model?(klass)
  klass&.ancestors&.include?(StoreModel::Model)
end

#raise_extract_wrapper_error(invalid_klass) ⇒ Object



5
6
7
8
# File 'lib/store_model/types/polymorphic_helper.rb', line 5

def raise_extract_wrapper_error(invalid_klass)
  raise StoreModel::Types::ExpandWrapperError,
        "#{invalid_klass.inspect} is an invalid model klass"
end