Module: Kind::Functional::Behavior

Defined in:
lib/kind/functional.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



18
19
20
21
22
# File 'lib/kind/functional.rb', line 18

def self.included(base)
  base.send(:alias_method, :[], :call)
  base.send(:alias_method, :===, :call)
  base.send(:alias_method, :yield, :call)
end

Instance Method Details

#initialize(arg = Empty::HASH) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/kind/functional.rb', line 24

def initialize(arg = Empty::HASH)
  hash = STRICT.kind_of(::Hash, arg)

  self.class.__dependencies__.each do |name, (kind, default, _visibility)|
    value_to_assign = ATTRIBUTES.value_to_assign!(kind, default, hash, name)

    instance_variable_set("@#{name}", value_to_assign)
  end
end