Class: Atreides::ContentPart

Inherits:
Base
  • Object
show all
Includes:
Base::Validation, Extendable
Defined in:
app/models/atreides/content_part.rb

Constant Summary collapse

@@content_types =

Constants

%w(text photos videos)
@@display_types =
%w(photos gallery)

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base::Validation

included

Methods inherited from Base

#dom_id, #to_param

Class Method Details

.base_classObject



61
62
63
# File 'app/models/atreides/content_part.rb', line 61

def base_class
  self
end

.content_typesObject



53
54
55
# File 'app/models/atreides/content_part.rb', line 53

def content_types
  @@content_types
end

.display_typesObject



57
58
59
# File 'app/models/atreides/content_part.rb', line 57

def display_types
  @@display_types
end

Instance Method Details

#content_typeObject

Instance Methods



70
71
72
# File 'app/models/atreides/content_part.rb', line 70

def content_type
  @_content_type ||= ActiveSupport::StringInquirer.new(read_attribute(:content_type)) unless read_attribute(:content_type).blank?
end

#content_typesObject



78
79
80
# File 'app/models/atreides/content_part.rb', line 78

def content_types
  self.class.content_types
end

#display_typeObject



74
75
76
# File 'app/models/atreides/content_part.rb', line 74

def display_type
  @_display_type ||= ActiveSupport::StringInquirer.new(read_attribute(:display_type)) unless read_attribute(:display_type).blank?
end