class Struct

Public Instance Methods

attributes() click to toggle source

Returns a hash containing the names and values for all instance settings in the Struct.

This will eventually be deprecated in favor of #to_h.

# File lib/core/facets/struct/attributes.rb, line 8
def attributes
  h = {}
  each_pair { |k,v| h[k] = v }
  h
end
object_state(data=nil) click to toggle source
# File lib/core/facets/object/object_state.rb, line 68
def object_state(data=nil)
  if data
    data.each_pair {|k,v| send(k.to_s + "=", v)}
  else
    data = {}
    each_pair{|k,v| data[k] = v}
    data
  end
end
replace(source) click to toggle source

#replace can take any source that responds to each_pair.

# File lib/core/facets/object/replace.rb, line 39
def replace(source)
  source.each_pair{ |k,v| send(k.to_s + "=", v) }
end
to_h() click to toggle source

Returns a hash containing the names and values for all instance settings in the Struct.

# File lib/core/facets/to_hash.rb, line 329
def to_h
  h = {}
  each_pair{ |k,v| h[k] = v }
  h
end