Class Struct
In: lib/facets/core/facets/object/replace.rb
lib/facets/core/facets/object/object_state.rb
lib/facets/core/facets/to_hash.rb
lib/facets/core/facets/struct/attributes.rb
Parent: Object

Methods

Public Instance methods

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.

[Source]

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

[Source]

# File lib/facets/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

Struct#replace can take any source that responds to each_pair.

[Source]

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

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

[Source]

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

[Validate]