module RGSS::BasicCoder
Constants
- INCLUDED_CLASSES
Public Class Methods
included(mod)
click to toggle source
# File lib/RGSS/BasicCoder.rb, line 31 def self.included(mod) INCLUDED_CLASSES.push(mod) end
set_ivars_methods(version)
click to toggle source
# File lib/RGSS/BasicCoder.rb, line 35 def self.set_ivars_methods(version) INCLUDED_CLASSES.each do |c| if version == :ace RGSS::reset_method(c, :ivars, ->{ return instance_variables }) else RGSS::reset_method(c, :ivars, ->{ return instance_variables.sort }) end end end
Public Instance Methods
decode(name, value)
click to toggle source
# File lib/RGSS/BasicCoder.rb, line 22 def decode(name, value) return value end
encode(name, value)
click to toggle source
# File lib/RGSS/BasicCoder.rb, line 11 def encode(name, value) return value end
encode_with(coder)
click to toggle source
# File lib/RGSS/BasicCoder.rb, line 3 def encode_with(coder) ivars.each do |var| name = var.to_s.sub(/^@/, '') value = instance_variable_get(var) coder[name] = encode(name, value) end end
init_with(coder)
click to toggle source
# File lib/RGSS/BasicCoder.rb, line 15 def init_with(coder) coder.map.each do |key, value| sym = "@#{key}".to_sym instance_variable_set(sym, decode(key, value)) end end
ivars()
click to toggle source
# File lib/RGSS/BasicCoder.rb, line 26 def ivars return instance_variables end