module Kind::Function
Public Class Methods
extended(base)
click to toggle source
# File lib/kind/function.rb, line 19 def self.extended(base) base.extend(Kind.of_module(base)) end
included(_)
click to toggle source
# File lib/kind/function.rb, line 15 def self.included(_) raise RuntimeError, "The Kind::Function can't be included, it can be only extended." end
Public Instance Methods
kind_function!()
click to toggle source
# File lib/kind/function.rb, line 23 def kind_function! return self if Kind.is?(Behavior, self) KIND.respond_to!(:call, self).extend(Behavior) if method(:call).parameters.empty? raise ArgumentError, "#{self.name}.call must receive at least one argument" end self.instance_eval( 'def to_proc; @to_proc ||= method(:call).to_proc; end' \ "\n" \ 'def curry; @curry ||= to_proc.curry; end' ) self.to_proc self.curry self end