lib/lego/model.rb
def as_json(opts={})
      raise NotImplementedError, 'as_json with arguments' unless opts.empty?
      {}.tap do |h|
        attributes.each do |attr, val|
          h[attr] = val.as_json
        end
      end
    end
def as_json(opts={})
      raise NotImplementedError, 'as_json with arguments' unless opts.empty?
      {}.tap do |h|
        attributes.each do |attr, val|
          h[attr] = val.as_json
        end
      end
    end
Serialize