Module: Cube::CubeMethods
- Defined in:
- lib/cube/toplevel.rb
Instance Method Summary collapse
Instance Method Details
#as_interface(iface, runtime_checks: true) ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/cube/toplevel.rb', line 84 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
97 98 99 100 101 |
# File 'lib/cube/toplevel.rb', line 97 def shell_implements(mod) instance_variable_set(:@__interface_runtime_check, false) instance_variable_set(:@__interface_arity_skip, true) include(mod) end |