Class: Dyph::Outcome::Conflicted

Inherits:
Dyph::Outcome show all
Defined in:
lib/dyph/outcome/conflicted.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Dyph::Outcome

#conflicted?, #resolved?

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

#baseObject (readonly)

Returns the value of attribute base.



3
4
5
# File 'lib/dyph/outcome/conflicted.rb', line 3

def base
  @base
end

#leftObject (readonly)

Returns the value of attribute left.



3
4
5
# File 'lib/dyph/outcome/conflicted.rb', line 3

def left
  @left
end

#rightObject (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

#hashObject



19
20
21
# File 'lib/dyph/outcome/conflicted.rb', line 19

def hash
  self.left.hash ^ self.base.hash ^ self.right.hash
end