Class: Material::Base

Inherits:
Spicerack::AttributeObject
  • Object
show all
Extended by:
ActiveSupport::NumberHelper
Includes:
Attributes, Components, Core, Display, For, Format, Site, Text
Defined in:
lib/material/base.rb

Constant Summary

Constants included from Text

Text::DEFAULT_TRUNCATE_LENGTH

Constants included from Components

Components::CLASSES_TO_DUPLICATE

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Attributes

#attribute_types, #attribute_values, #formatted_attributes, #human_attribute_value, #relationship_attributes, #sorted_attribute_names

Methods included from Site

#default_parent

Methods included from Core

#initialize

Class Method Details

.for(object) ⇒ Object



18
19
20
21
# File 'lib/material/base.rb', line 18

def self.for(object)
  material_class = material_class_for(object, "Material")
  material_class.new(object) if material_class.present?
end

Instance Method Details

#to_modelObject



27
28
29
# File 'lib/material/base.rb', line 27

def to_model
  self
end

#to_source_modelObject



23
24
25
# File 'lib/material/base.rb', line 23

def to_source_model
  source.to_model
end