Skip to content

Instantly share code, notes, and snippets.

@tissak
Created February 10, 2013 23:48
Show Gist options
  • Save tissak/4751575 to your computer and use it in GitHub Desktop.
Save tissak/4751575 to your computer and use it in GitHub Desktop.
Demonstrating working and non working module change code in rubymotion. Code was verified on rake console.
(main)> z.q
Assertion failed: (b != NULL), function rb_vm_block_method_imp, file vm.cpp, line 3000.
*** simulator session ended with error: Error Domain=DTiPhoneSimulatorErrorDomain Code=1 "The simulated application quit." UserInfo=0x100461550 {NSLocalizedDescription=The simulated application quit., DTiPhoneSimulatorUnderlyingErrorCodeKey=-1}
rake aborted!
Command failed with status (1): [DYLD_FRAMEWORK_PATH="/Applications/Xcode.a...]
/Library/RubyMotion/lib/motion/project.rb:101:in `block in <top (required)>'
mod = Module.new do
public_class_method :define_method
def q
'q'
end
end
mod.define_method :r do
'r'
end
Kernel.const_set 'X', mod
class Y
include X
end
z = Y.new
z.q
#> q
z.r
# Crash
# Assertion failed: (b != NULL), function rb_vm_block_method_imp, file vm.cpp, line 3000.
Module B
def a
'a'
end
end
Class A
include B
end
a = A.new
a.a
#> a
Module B
def c
'c'
end
end
a.c
#> c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment