class SimpleObjectSerialization::Attributes

Attributes

attributes[R]

Public Class Methods

new() click to toggle source
# File lib/simple_object_serialization/attributes.rb, line 7
def initialize
  @attributes = []
end

Public Instance Methods

hash_for(serializer) click to toggle source
# File lib/simple_object_serialization/attributes.rb, line 15
def hash_for(serializer)
  {}.tap do |hash|
    attributes.each do |attribute|
      next if attribute.skip_for?(serializer)

      hash[attribute.name] = attribute.value_for(serializer)
    end
  end
end
push(attribute) click to toggle source
# File lib/simple_object_serialization/attributes.rb, line 11
def push(attribute)
  attributes.push(attribute)
end