class Gamefic::Props::Output
data.
A container for output sent to players with a hash interface for custom
def [](key)
-
key
(Symbol
) --
def [](key) raw_data[key] end
def []=(key, value)
-
value
(Object
) -- -
key
(Symbol
) --
def []=(key, value) raw_data[key] = value end
def freeze
def freeze raw_data.freeze super end
def initialize **data
def initialize **data @raw_data = { messages: '', options: [], queue: [], scene: {}, prompt: '' } merge! data end
def merge!(data)
def merge!(data) data.each { |key, val| self[key] = val } end
def method_missing method, *args
def method_missing method, *args return raw_data[method] if READER_METHODS.include?(method) return raw_data[method.to_s[0..-2].to_sym] = args.first if WRITER_METHODS.include?(method) super end
def replace(data)
def replace(data) raw_data.replace data end
def respond_to_missing?(method, _with_private = false)
def respond_to_missing?(method, _with_private = false) READER_METHODS.include?(method) || WRITER_METHODS.include?(method) end
def to_hash
-
(Hash)
-
def to_hash raw_data.dup end
def to_json(_ = nil)
def to_json(_ = nil) raw_data.to_json end