lib/oscal/property.rb in oscal-0.1.0 vs lib/oscal/property.rb in oscal-0.1.1
- old
+ new
@@ -1,32 +1,10 @@
-require_relative "serializer"
+require_relative "base_class"
module Oscal
- class Property
- include Serializer
+ class Property < Oscal::BaseClass
+ KEY = %i(name uuid ns value klass remarks)
- KEY = %i(name value)
attr_accessor *KEY
attr_serializable *KEY
-
- def self.wrap(obj)
- return obj if obj.is_a? Property
- return Property.new(obj) unless obj.is_a? Array
-
- obj.map do |x|
- Property.wrap(x)
- end
- end
-
- def initialize(options={})
- options.each_pair.each do |key,val|
- key_name = key.gsub('-','_')
-
- unless KEY.include?(key_name.to_sym)
- raise UnknownAttributeError.new("Unknown key `#{key}` in Property")
- end
-
- self.send("#{key_name}=", val)
- end
- end
end
end