Class: StreetFighter::Right

Inherits:
EitherValue show all
Defined in:
lib/street_fighter/right.rb

Instance Attribute Summary

Attributes inherited from EitherValue

#value

Instance Method Summary collapse

Methods inherited from EitherValue

#==, #failable, #initialize

Constructor Details

This class inherits a constructor from StreetFighter::EitherValue

Instance Method Details

#bind(func) ⇒ Object



16
17
18
# File 'lib/street_fighter/right.rb', line 16

def bind func
  func.call(value)
end

#match(other) ⇒ Object



3
4
5
6
# File 'lib/street_fighter/right.rb', line 3

def match other
  EitherCheck.new(other).run!
  other
end

#tournament(*fns) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/street_fighter/right.rb', line 8

def tournament *fns
  return self if fns.empty?

  bind(fns.first).tap do |result|
    EitherCheck.new(result).run!
  end.tournament(*fns[1..-1])
end