Sha256: 4f972544eadff059ad26142909f9126390d6220f881630b70d9105516ed219aa

Contents?: true

Size: 436 Bytes

Versions: 3

Compression:

Stored size: 436 Bytes

Contents

module Arrest
  class Ref
    include HasAttributes

    attribute :id, String
    attribute :type, String

    def self.mk_json(value)
      {:id => value.id, :type => value.type}.to_json
    end
  end

  class PolymorphicAttribute < NestedAttribute
    def initialize name, actions
      super name, Ref, actions
    end

    def from_hash(parent, value)
      return nil unless value != nil
      @clazz.new(value)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arrest-0.0.85 lib/arrest/attributes/polymorphic_attribute.rb
arrest-0.0.84 lib/arrest/attributes/polymorphic_attribute.rb
arrest-0.0.83.crud lib/arrest/attributes/polymorphic_attribute.rb