Module: Cinnabar::FnPipe

Defined in:
lib/cinnabar/pipe.rb,
lib/cinnabar/pipe.rb

Defined Under Namespace

Modules: Ext, Mixin, Refin

Class Method Summary collapse

Class Method Details

.(obj, other) ⇒ Object

rubocop:disable Naming/MethodName



6
7
8
9
10
11
12
13
14
# File 'lib/cinnabar/pipe.rb', line 6

def (obj, other) # rubocop:disable Naming/MethodName
  callable =
    case other
      when Proc, Method then other
      when Symbol, String then Kernel.method(other)
      else Kernel.raise ArgumentError, "Unsupported type: #{other.class}"
    end
  callable.call(obj)
end