Module: UnionType

Extended by:
Helper
Included in:
Either
Defined in:
lib/union_type.rb

Instance Method Summary collapse

Methods included from Helper

alias_names

Instance Method Details

#when(what) ⇒ Either

Returns:



13
14
15
16
17
18
19
20
# File 'lib/union_type.rb', line 13

def when what
  current_class = self.class.to_s.to_sym
  if what.include? current_class
    what[current_class].(@v)
  elsif what.include? :_
    what[:_].(@v)
  end
end