class WrapperBased::Casting::Director
Public Class Methods
new(talent_pool)
click to toggle source
Calls superclass method
# File lib/wrapper_based/casting/director.rb, line 5 def initialize(talent_pool) super(Casting.new, talent_pool) end
Public Instance Methods
adds(role, talent = TALENTLESS)
click to toggle source
# File lib/wrapper_based/casting/director.rb, line 7 def adds(role, talent = TALENTLESS) case talent when ::Proc, ::Method, ::Symbol casting.casts role, &talent when ::Class casting.casts role, &talent.method(:new) when ::Module casting.casts_as role, &type_for(role).has(talent).method(:typecast) else throw :wrong_talent_type, [role, talent, "expected Module, Class, Proc, Method or Symbol"] end end
to_proc()
click to toggle source
# File lib/wrapper_based/casting/director.rb, line 20 def to_proc method(:adds).to_proc end
type_for(role)
click to toggle source
# File lib/wrapper_based/casting/director.rb, line 24 def type_for(role) Casting::Type.new(role, talent_pool) end