Class: PubSubModelSync::Subscriber
- Defined in:
- lib/pub_sub_model_sync/subscriber.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#from_klass ⇒ Object
Returns the value of attribute from_klass.
-
#klass ⇒ Object
Returns the value of attribute klass.
-
#mapping ⇒ Object
Returns the value of attribute mapping.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#settings ⇒ Object
Returns the value of attribute settings.
Instance Method Summary collapse
-
#initialize(klass, action, mapping: [], settings: {}) ⇒ Subscriber
constructor
A new instance of Subscriber.
Methods inherited from Base
Constructor Details
#initialize(klass, action, mapping: [], settings: {}) ⇒ Subscriber
Returns a new instance of Subscriber.
12 13 14 15 16 17 18 19 20 |
# File 'lib/pub_sub_model_sync/subscriber.rb', line 12 def initialize(klass, action, mapping: [], settings: {}) def_settings = { from_klass: klass, to_action: action, id: :id, if: nil, unless: nil, mode: :model } @klass = klass @mapping = mapping @settings = def_settings.merge(settings) @action = action.to_sym @from_klass = @settings[:from_klass].to_s @mode = @settings[:mode].to_sym end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
5 6 7 |
# File 'lib/pub_sub_model_sync/subscriber.rb', line 5 def action @action end |
#from_klass ⇒ Object
Returns the value of attribute from_klass.
5 6 7 |
# File 'lib/pub_sub_model_sync/subscriber.rb', line 5 def from_klass @from_klass end |
#klass ⇒ Object
Returns the value of attribute klass.
5 6 7 |
# File 'lib/pub_sub_model_sync/subscriber.rb', line 5 def klass @klass end |
#mapping ⇒ Object
Returns the value of attribute mapping.
5 6 7 |
# File 'lib/pub_sub_model_sync/subscriber.rb', line 5 def mapping @mapping end |
#mode ⇒ Object
Returns the value of attribute mode.
5 6 7 |
# File 'lib/pub_sub_model_sync/subscriber.rb', line 5 def mode @mode end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
6 7 8 |
# File 'lib/pub_sub_model_sync/subscriber.rb', line 6 def model @model end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
6 7 8 |
# File 'lib/pub_sub_model_sync/subscriber.rb', line 6 def payload @payload end |
#settings ⇒ Object
Returns the value of attribute settings.
5 6 7 |
# File 'lib/pub_sub_model_sync/subscriber.rb', line 5 def settings @settings end |