Sha256: e6d8efd4f6e359dbe4b49d9e76d72bb912b2ab04647b140042795af83cb1fd3e

Contents?: true

Size: 450 Bytes

Versions: 30

Compression:

Stored size: 450 Bytes

Contents

class Struct
  ##
  # 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
  def attributes
    h = {}
    each_pair { |k,v| h[k] = v }
    h
  end
end # class Struct

Version data entries

30 entries across 29 versions & 7 rubygems

Version Path
extlib-0.9.16 lib/extlib/struct.rb
extlib-0.9.15 lib/extlib/struct.rb
robsharp-extlib-0.9.15 lib/extlib/struct.rb
sundbp-extlib-0.9.14 lib/extlib/struct.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.8/gems/extlib-0.9.14/lib/extlib/struct.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.9.1/gems/extlib-0.9.14/lib/extlib/struct.rb
middleman-0.12.2 lib/middleman/vendor/gems/gems/extlib-0.9.14/lib/extlib/struct.rb
middleman-0.12.1 lib/middleman/vendor/gems/gems/extlib-0.9.14/lib/extlib/struct.rb
extlib-0.9.14 lib/extlib/struct.rb
ginst-2009.12.8 vendor/gems/extlib-0.9.13/lib/extlib/struct.rb
middleman-0.12.0.pre3 lib/middleman/vendor/gems/gems/extlib-0.9.13/lib/extlib/struct.rb
middleman-0.12.0.pre2 lib/middleman/vendor/gems/gems/extlib-0.9.13/lib/extlib/struct.rb
middleman-0.12.0.pre lib/middleman/vendor/gems/gems/extlib-0.9.13/lib/extlib/struct.rb
ginst-2009.11.24 vendor/gems/extlib-0.9.13/lib/extlib/struct.rb
ginst-2009.11.23 vendor/gems/extlib-0.9.13/lib/extlib/struct.rb
rango-0.0.6 vendor/extlib/lib/extlib/struct.rb
rango-0.1.pre vendor/extlib/lib/extlib/struct.rb
middleman-0.10.17 vendor/gems/gems/extlib-0.9.13/lib/extlib/struct.rb
middleman-0.10.16 vendor/gems/gems/extlib-0.9.13/lib/extlib/struct.rb
middleman-0.10.15 vendor/gems/gems/extlib-0.9.13/lib/extlib/struct.rb