Module OpenStructable
In: lib/more/facets/ostructable.rb

OpensStructable is a mixin module which can provide OpenStruct behavior to any class or object. OpenStructable allows extention of data objects with arbitrary attributes.

Usage

  require 'ostructable'

  class Record
    include OpenStructable
  end

  record = Record.new
  record.name    = "John Smith"
  record.age     = 70
  record.pension = 300

  puts record.name     # -> "John Smith"
  puts record.address  # -> nil

Author(s)

  • Thomas Sawyer
  • Yukihiro Matsumoto
  • Gavin Sinclair (Documentation)

Methods

Public Class methods

Public Instance methods

Compare this object and other for equality.

Remove the named field from the object.

duplicate an OpenStruct object members.

Returns a string containing a detailed summary of the keys and values.

Generate additional attributes and values.

[Validate]