varvet / serial

Plain old Ruby for generating primitive data structures from object graphs.
107 stars 2 forks source link

Short-hand for attribute #2

Closed Burgestrand closed 9 years ago

Burgestrand commented 9 years ago

e.g.

ProjectSerializer = Serial::Serializer.new do |h, project|
  h.attribute(:id) # => no value, no block => project.id
end
Burgestrand commented 9 years ago

If this is done, care should be taken to still allow nil as a value for attributes.

Burgestrand commented 9 years ago

I don't think I like this, it's too implicit.