1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
module RGen
module MetamodelBuilder
module Intermediate
class Annotation
attr_reader :details, :source
def initialize(hash)
if hash[:source] || hash[:details]
restKeys = hash.keys - [:source, :details]
raise "Hash key #{restKeys.first} not allowed." unless restKeys.empty?
raise "Details not provided, key :details is missing" unless hash[:details]
raise "Details must be provided as a hash" unless hash[:details].is_a?(Hash)
@details = hash[:details]
@source = hash[:source]
else
raise "Details must be provided as a hash" unless hash.is_a?(Hash)
@details = hash
end
end
end
end
end
end
|