Class: Draisine::ConflictDetector
- Inherits:
-
Object
- Object
- Draisine::ConflictDetector
- Defined in:
- lib/draisine/conflict_detector.rb
Instance Attribute Summary collapse
-
#attributes_list ⇒ Object
readonly
Returns the value of attribute attributes_list.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#remote_model ⇒ Object
readonly
Returns the value of attribute remote_model.
Instance Method Summary collapse
- #conflict? ⇒ Boolean
- #conflict_type ⇒ Object
- #diff ⇒ Object
-
#initialize(model, remote_model, attributes_list = model.class.salesforce_audited_attributes) ⇒ ConflictDetector
constructor
A new instance of ConflictDetector.
Constructor Details
#initialize(model, remote_model, attributes_list = model.class.salesforce_audited_attributes) ⇒ ConflictDetector
Returns a new instance of ConflictDetector.
4 5 6 7 8 |
# File 'lib/draisine/conflict_detector.rb', line 4 def initialize(model, remote_model, attributes_list = model.class.salesforce_audited_attributes) @model = model @remote_model = remote_model @attributes_list = attributes_list end |
Instance Attribute Details
#attributes_list ⇒ Object (readonly)
Returns the value of attribute attributes_list.
3 4 5 |
# File 'lib/draisine/conflict_detector.rb', line 3 def attributes_list @attributes_list end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
3 4 5 |
# File 'lib/draisine/conflict_detector.rb', line 3 def model @model end |
#remote_model ⇒ Object (readonly)
Returns the value of attribute remote_model.
3 4 5 |
# File 'lib/draisine/conflict_detector.rb', line 3 def remote_model @remote_model end |
Instance Method Details
#conflict? ⇒ Boolean
10 11 12 |
# File 'lib/draisine/conflict_detector.rb', line 10 def conflict? conflict_type != :no_conflict end |
#conflict_type ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/draisine/conflict_detector.rb', line 14 def conflict_type if model && remote_model if diff.diff_keys.empty? :no_conflict else :mismatching_records end elsif model :remote_record_missing elsif remote_model :local_record_missing else :no_conflict end end |