Class: MailControl::Definition
- Inherits:
-
Object
- Object
- MailControl::Definition
- Defined in:
- lib/mail-control/definition.rb
Instance Attribute Summary collapse
-
#act_object ⇒ Object
readonly
Returns the value of attribute act_object.
-
#act_target ⇒ Object
readonly
Returns the value of attribute act_target.
-
#actor ⇒ Object
readonly
Returns the value of attribute actor.
-
#bond_type ⇒ Object
readonly
Returns the value of attribute bond_type.
-
#grouped_actor ⇒ Object
readonly
Returns the value of attribute grouped_actor.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#unsubscribe_by ⇒ Object
readonly
Returns the value of attribute unsubscribe_by.
Class Method Summary collapse
- .find(name) ⇒ Object
-
.register(definition) ⇒ Definition
Registers a new definition.
-
.registered ⇒ Array<MailControl::Definition>
List of registered definitions.
Instance Method Summary collapse
-
#initialize(definition) ⇒ Definition
constructor
A new instance of Definition.
Constructor Details
#initialize(definition) ⇒ Definition
Returns a new instance of Definition.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/mail-control/definition.rb', line 10 def initialize(definition) @name = definition[:name] @actor = definition[:actor] || nil @act_object = definition[:act_object] || nil @act_target = definition[:act_target] || nil @grouped_actor = definition[:grouped_actor] || nil @bond_type = definition[:bond_type] || nil @options = definition[:options] || [] @unsubscribe_by = definition[:unsubscribe_by] || nil end |
Instance Attribute Details
#act_object ⇒ Object (readonly)
Returns the value of attribute act_object.
5 6 7 |
# File 'lib/mail-control/definition.rb', line 5 def act_object @act_object end |
#act_target ⇒ Object (readonly)
Returns the value of attribute act_target.
5 6 7 |
# File 'lib/mail-control/definition.rb', line 5 def act_target @act_target end |
#actor ⇒ Object (readonly)
Returns the value of attribute actor.
5 6 7 |
# File 'lib/mail-control/definition.rb', line 5 def actor @actor end |
#bond_type ⇒ Object (readonly)
Returns the value of attribute bond_type.
5 6 7 |
# File 'lib/mail-control/definition.rb', line 5 def bond_type @bond_type end |
#grouped_actor ⇒ Object (readonly)
Returns the value of attribute grouped_actor.
5 6 7 |
# File 'lib/mail-control/definition.rb', line 5 def grouped_actor @grouped_actor end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/mail-control/definition.rb', line 5 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/mail-control/definition.rb', line 5 def @options end |
#unsubscribe_by ⇒ Object (readonly)
Returns the value of attribute unsubscribe_by.
6 7 8 |
# File 'lib/mail-control/definition.rb', line 6 def unsubscribe_by @unsubscribe_by end |
Class Method Details
.find(name) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/mail-control/definition.rb', line 40 def self.find(name) unless definition = registered.find{|definition| definition.name == name.to_sym} raise MailControl::InvalidLoggedEmail, "Could not find a definition for `#{name}`" else definition end end |
.register(definition) ⇒ Definition
Registers a new definition
27 28 29 30 31 32 |
# File 'lib/mail-control/definition.rb', line 27 def self.register(definition) return false unless definition.is_a? DefinitionDSL definition = new(definition) self.registered << definition return definition || false end |
.registered ⇒ Array<MailControl::Definition>
List of registered definitions
36 37 38 |
# File 'lib/mail-control/definition.rb', line 36 def self.registered @definitions ||= [] end |