Class: Material::Base

Inherits:
Spicerack::AttributeObject
  • Object
show all
Extended by:
ActiveSupport::NumberHelper
Includes:
Conjunction::Junction, Attributes, Components, Core, Display, 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



21
22
23
# File 'lib/material/base.rb', line 21

def for(object)
  for_class(object)&.new(object)
end

.for_class(object) ⇒ Object



25
26
27
# File 'lib/material/base.rb', line 25

def for_class(object)
  object.try(:conjugate!, self)
end

Instance Method Details

#to_modelObject



34
35
36
# File 'lib/material/base.rb', line 34

def to_model
  self
end

#to_source_modelObject



30
31
32
# File 'lib/material/base.rb', line 30

def to_source_model
  source.to_model
end