Class: Mailboxer::BaseBuilder
- Inherits:
-
Object
- Object
- Mailboxer::BaseBuilder
- Defined in:
- app/builders/mailboxer/base_builder.rb
Direct Known Subclasses
ConversationBuilder, MessageBuilder, NotificationBuilder, ReceiptBuilder
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(params) ⇒ BaseBuilder
constructor
A new instance of BaseBuilder.
Constructor Details
#initialize(params) ⇒ BaseBuilder
Returns a new instance of BaseBuilder.
5 6 7 |
# File 'app/builders/mailboxer/base_builder.rb', line 5 def initialize(params) @params = params.with_indifferent_access end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'app/builders/mailboxer/base_builder.rb', line 3 def params @params end |
Instance Method Details
#build ⇒ Object
9 10 11 12 13 14 15 |
# File 'app/builders/mailboxer/base_builder.rb', line 9 def build klass.new.tap do |object| params.keys.each do |field| object.send("#{field}=", get(field)) unless get(field).nil? end end end |