Type:
Class

Struct serialization/deserialization

A Struct is a convenient way to bundle a number of attributes together, using accessor methods, without having to write an explicit class.

The Struct class is a generator of specific classes, each one of which is defined to hold a set of variables and their accessors. In these examples, we'll call the generated class “CustomerClass,'' and we'll show an example instance of that class as “CustomerInst.''

In the descriptions that follow, the parameter symbol refers to a symbol, which is either a quoted string or a Symbol (such as :name).

each_pair
  • References/Ruby on Rails/Ruby/Classes/Struct

struct.each_pair {|sym, obj| block } â structstruct.each_pair â an_enumerator

2025-01-10 15:47:30
values_at
  • References/Ruby on Rails/Ruby/Classes/Struct

struct.values_at(selector,... ) â an_array Instance Public methods Returns

2025-01-10 15:47:30
as_json
  • References/Ruby on Rails/Ruby/Classes/Struct

as_json(*) Instance Public methods Returns a hash, that will be turned into

2025-01-10 15:47:30