Class: ActiveNotifier::Base::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/active_notifier/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



62
63
64
65
66
67
68
69
# File 'lib/active_notifier/base.rb', line 62

def initialize
  @data = {
    from: nil,
    email_attribute: nil,
    subject: nil,
    superclass: ActionMailer::Base
  }
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &blk) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/active_notifier/base.rb', line 73

def method_missing(*args, &blk)
  attribute, value = args
  if value.present?
    @data[attribute] = value
  elsif block_given?
    @data[attribute] = blk
  else
    @data.fetch attribute do
      super
    end
  end
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



60
61
62
# File 'lib/active_notifier/base.rb', line 60

def data
  @data
end

Instance Method Details

#respond_to?(*args, &blk) ⇒ Boolean

Returns:

  • (Boolean)


86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/active_notifier/base.rb', line 86

def respond_to?(*args, &blk)
  attribute, value = args
  if value.present?
    true
  elsif block_given?
    true
  else
    @data.fetch attribute do
      super
    end
  end
end