Module: Cube::CubeMethods
- Defined in:
- lib/cube/toplevel.rb
Instance Method Summary collapse
Instance Method Details
#as_interface(iface, runtime_checks: true) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/cube/toplevel.rb', line 88 def as_interface(iface, runtime_checks: true) raise ArgumentError, "#{iface} is not a Cube::Interface" unless iface.is_a?(Cube::Interface) implements = lambda { |this| unless this.is_a? Class raise "Non-Class modules cannot implement interfaces" end this.instance_variable_set(:@__interface_runtime_check, true) if runtime_checks this.include(iface) } implements.call(clone) end |
#shell_implements(mod) ⇒ Object
101 102 103 104 105 |
# File 'lib/cube/toplevel.rb', line 101 def shell_implements(mod) instance_variable_set(:@__interface_runtime_check, false) instance_variable_set(:@__interface_arity_skip, true) include(mod) end |