Module: Transit::Deliverable::ClassMethods
- Defined in:
- lib/transit/deliverable.rb
Overview
Class level methods and functionality
Instance Method Summary (collapse)
-
- (Object) deliver_as(type, options = {})
Configures attributes and deliverable specific methods for the calling model.
Instance Method Details
- (Object) deliver_as(type, options = {})
Configures attributes and deliverable specific methods for the calling model.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/transit/deliverable.rb', line 59 def deliver_as(type, = {}) include Transit::Definition::Base self. ||= Transit::Deliverable::DeliveryOptions.new(.reverse_merge!(:translate => Transit.config.translate)) self.delivers_as = type self..merge!() self.has_translation_support = !!self..translate unless Transit::Definition.const_defined?(type.to_s.classify) raise Transit::Definition::MissingDefinitionError end include Transit::Definition.const_get(type.to_s.classify) # register the deliverable class delivery = type.to_s.classify Transit.deliverables[delivery] ||= [] Transit.deliverables[delivery] |= [self.name.to_s] Transit.run_definition_hooks(:#{type.to_s}", self) end |