Ruby | Struct members() function
Syntax: struct_name.members() Parameters: The function does not accepts any parameter. Return Value: It returns the array with struct members.Example 1:
# Ruby program for members method in struct
# Include struct
Student = Struct.new(:name, :address, :dept , :project)
#initialize values
detail = Student.new("Vishwa", "Hyderabad", "CSE" , "IOT")
# members used
puts detail.members
name address dept projectExample 2:
# Ruby program for members method in struct
# Include struct
Movie = Struct.new(:name, :imdbrating)
# initialize values
detail = Movie.new("3idiots", 5)
# members used
puts detail.members
name imdbrating