Class: Struct

### Home Classes Methods

### In Files

- lib/extlib/struct.rb

### Parent

Object

### Methods

- #attributes

### Files

- LICENSE
- README.rdoc

### Class/Module Index

Quicksearch

- Extlib
- Extlib::Assertions
- Extlib::ByteArray
- Extlib::Hook
- Extlib::Hook::ClassMethods
- Extlib::Inflection
- Extlib::LocalObjectSpace
- Extlib::Logger
- Extlib::Pooling
- Extlib::Pooling::InvalidResourceError
- Extlib::Pooling::Pool
- Extlib::SimpleSet
- Gem
- Gem::SourceIndex
- Gem::Specification
- LazyModule
- LazyModule::ClassMethods
- Array
- Class
- DateTime
- Dictionary
- FalseClass
- Hash
- LazyArray
- Mash
- Module
- NilClass
- Numeric
- Object
- ObjectSpace
- Pathname
- REXMLUtilityNode
- String
- Struct
- Symbol
- Time
- ToHashParser
- TrueClass
- VirtualFile

No matching classes.

# Struct

### Public Instance Methods

attributes() click to toggle source

Get a hash with names and values of all instance variables.

    class Foo < Struct.new(:name, :age, :gender); end
    f = Foo.new("Jill", 50, :female)
    f.attributes   #=> {:name => "Jill", :age => 50, :gender => :female}

@return [Hash] Hash of instance variables in receiver, keyed by ivar name

@api public

    # File lib/extlib/struct.rb, line 12
    def attributes
      h = {}
      each_pair { |k,v| h[k] = v }
      h
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.