Method: Uinit::Type::Impl#initialize
- Defined in:
- lib/uinit/type/impl.rb
#initialize(*sym_interface, **interface) ⇒ Impl
TODO: Allow to pass Fn
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/uinit/type/impl.rb', line 7 def initialize(*sym_interface, **interface) super() sym_interface.each do |meth| next if meth.is_a?(Symbol) raise ArgumentError, "#{meth.inspect} must be a Symbol" end interface.each do |(meth, fn)| next if fn.nil? || fn.is_a?(Fn) raise ArgumentError, "#{meth.inspect} must be Fn or Nil" end @interface = sym_interface.each_with_object(interface.dup) do |meth, inter| inter[meth] = nil end end |