Class: DigestEmail::PerformableDigest
- Inherits:
-
Object
- Object
- DigestEmail::PerformableDigest
- Defined in:
- lib/digest_email/performable_digest.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#method_name ⇒ Object
Returns the value of attribute method_name.
-
#object ⇒ Object
Returns the value of attribute object.
Instance Method Summary collapse
- #ensure_digest_group ⇒ Object
-
#initialize(object, method_name, args) ⇒ PerformableDigest
constructor
A new instance of PerformableDigest.
- #mailer_name ⇒ Object
Constructor Details
#initialize(object, method_name, args) ⇒ PerformableDigest
Returns a new instance of PerformableDigest.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/digest_email/performable_digest.rb', line 7 def initialize(object, method_name, args) raise NoMethodError, "undefined method `#{method_name}' for #{object.inspect}" unless object.respond_to?(method_name, true) if object.respond_to?(:new_record?) && object.new_record? raise(ArgumentError, 'Digest cannot be created for records before they\'ve been persisted') end self.object = object self.args = args self.method_name = method_name.to_sym end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
3 4 5 |
# File 'lib/digest_email/performable_digest.rb', line 3 def args @args end |
#method_name ⇒ Object
Returns the value of attribute method_name.
3 4 5 |
# File 'lib/digest_email/performable_digest.rb', line 3 def method_name @method_name end |
#object ⇒ Object
Returns the value of attribute object.
3 4 5 |
# File 'lib/digest_email/performable_digest.rb', line 3 def object @object end |
Instance Method Details
#ensure_digest_group ⇒ Object
27 28 29 |
# File 'lib/digest_email/performable_digest.rb', line 27 def ensure_digest_group DigestEmailGroup.find_or_create_by_mailer_name_and_method_name mailer_name, method_name end |
#mailer_name ⇒ Object
19 20 21 |
# File 'lib/digest_email/performable_digest.rb', line 19 def mailer_name object.class.to_s end |