Class: Dyph::Outcome::Conflicted
- Inherits:
-
Dyph::Outcome
- Object
- Dyph::Outcome
- Dyph::Outcome::Conflicted
- Defined in:
- lib/dyph/outcome/conflicted.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #apply(fun) ⇒ Object
- #hash ⇒ Object
-
#initialize(left:, base:, right:) ⇒ Conflicted
constructor
A new instance of Conflicted.
Methods inherited from Dyph::Outcome
Constructor Details
#initialize(left:, base:, right:) ⇒ Conflicted
Returns a new instance of Conflicted.
4 5 6 7 8 |
# File 'lib/dyph/outcome/conflicted.rb', line 4 def initialize(left:, base:, right:) @left = left @base = base @right = right end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
3 4 5 |
# File 'lib/dyph/outcome/conflicted.rb', line 3 def base @base end |
#left ⇒ Object (readonly)
Returns the value of attribute left.
3 4 5 |
# File 'lib/dyph/outcome/conflicted.rb', line 3 def left @left end |
#right ⇒ Object (readonly)
Returns the value of attribute right.
3 4 5 |
# File 'lib/dyph/outcome/conflicted.rb', line 3 def right @right end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
10 11 12 13 14 15 |
# File 'lib/dyph/outcome/conflicted.rb', line 10 def ==(other) self.class == other.class && self.left == other.left && self.base == other.base && self.right == other.right end |
#apply(fun) ⇒ Object
23 24 25 |
# File 'lib/dyph/outcome/conflicted.rb', line 23 def apply(fun) self.class.new(left: fun[@left], base: fun[@base], right: fun[@right]) end |
#hash ⇒ Object
19 20 21 |
# File 'lib/dyph/outcome/conflicted.rb', line 19 def hash self.left.hash ^ self.base.hash ^ self.right.hash end |