Categories
How to create an empty object?
How to create an empty object in Ruby. You need something like this, but you don’t want to create a class for such actions.
a = Object.new a.variable = '1'
Answer the question
In order to leave comments, you need to log in
require 'ostruct' a = OpenStruct.new a.variable = 1
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question