Singleton module in mruby.
class Example
include Singleton
attr_accessor :keep
end
a = Example.instance
b = Example.instance
a.keep = "keep this"
p b.keep #=> "keep this"
a.keep = nil
p b.keep #=> nil
Write in /mruby/build_config.rb
MRuby::Build.new do |conf|
conf.gem :github => 'ksss/mruby-singleton', :branch => 'master'
end
mgem add mruby-singleton
and exec in your /mruby.
rake clean
rake
rake test
MIT