Module: Lesmok::Acid::Meltable
- Includes:
- Helpers
- Defined in:
- lib/lesmok/acid/meltable.rb
Overview
Indicate that a model can be liquified.
Instance Method Summary collapse
-
#liquify_drop_klass ⇒ Object
We expect Drop classes to be in same namespace as the object class.
-
#liquify_dynamically ⇒ Object
Fallback to trying to find the drop class dynamically or use generic AcidDrop if it can’t be found.
-
#to_liquid ⇒ Object
Liquify…
-
#to_solid ⇒ Object
Solidify.
Methods included from Helpers
Instance Method Details
#liquify_drop_klass ⇒ Object
We expect Drop classes to be in same namespace as the object class.
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/lesmok/acid/meltable.rb', line 44 def liquify_drop_klass str = self.class.name + 'Drop' klass = str.split('::').inject(Object) do |mod, class_name| mod.const_get(class_name) end klass rescue NameError => err msg = "[#{self.class}] Could not find liquid drop class..." ::Lesmok.logger.warn(msg) if Lesmok.config.debugging? Drop end |
#liquify_dynamically ⇒ Object
Fallback to trying to find the drop class dynamically or use generic AcidDrop if it can’t be found.
35 36 37 38 39 |
# File 'lib/lesmok/acid/meltable.rb', line 35 def liquify_dynamically return @liquid_drop if @liquid_drop klass = liquify_drop_klass || AcidDrop @liquid_drop = klass.new(self) end |
#to_liquid ⇒ Object
Liquify…
22 23 24 |
# File 'lib/lesmok/acid/meltable.rb', line 22 def to_liquid @liquid_drop ||= liquify_dynamically end |
#to_solid ⇒ Object
Solidify
27 28 29 |
# File 'lib/lesmok/acid/meltable.rb', line 27 def to_solid self end |