Class: Iron::ContentType

Inherits:
ApplicationRecord show all
Includes:
Exportable, Importable, Titlable, WebPublishable
Defined in:
app/models/iron/content_type.rb

Defined Under Namespace

Modules: Exportable, FieldQueryable, Importable, Titlable, WebPublishable

Constant Summary collapse

TYPES =
%w[Single Collection].freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Titlable

#titlable_definitions

Methods included from WebPublishable

#index_entry, #path_for

Methods included from Exportable

#export_attributes

Class Method Details

.classify_type(type) ⇒ Object



23
24
25
# File 'app/models/iron/content_type.rb', line 23

def classify_type(type)
  "Iron::ContentTypes::#{type}"
end

.inherited(subclass) ⇒ Object



27
28
29
30
31
32
# File 'app/models/iron/content_type.rb', line 27

def inherited(subclass)
  super
  def subclass.model_name
    superclass.model_name
  end
end

Instance Method Details

#collection?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'app/models/iron/content_type.rb', line 43

def collection?
  is_a?(ContentTypes::Collection)
end

#humanized_typeObject



35
36
37
# File 'app/models/iron/content_type.rb', line 35

def humanized_type
  type.demodulize
end

#single?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'app/models/iron/content_type.rb', line 39

def single?
  is_a?(ContentTypes::Single)
end