Class: RGen::MetamodelBuilder::Intermediate::Annotation

Inherits:
Object
  • Object
show all
Defined in:
lib/rgen/metamodel_builder/intermediate/annotation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Annotation

Returns a new instance of Annotation.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rgen/metamodel_builder/intermediate/annotation.rb', line 10

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

Instance Attribute Details

#detailsObject (readonly)

Returns the value of attribute details.



8
9
10
# File 'lib/rgen/metamodel_builder/intermediate/annotation.rb', line 8

def details
  @details
end

#sourceObject (readonly)

Returns the value of attribute source.



8
9
10
# File 'lib/rgen/metamodel_builder/intermediate/annotation.rb', line 8

def source
  @source
end