Class: RGen::MetamodelBuilder::Intermediate::Annotation
- Inherits:
-
Object
- Object
- RGen::MetamodelBuilder::Intermediate::Annotation
- Defined in:
- lib/rgen/metamodel_builder/intermediate/annotation.rb
Instance Attribute Summary collapse
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Annotation
constructor
A new instance of Annotation.
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
#details ⇒ Object (readonly)
Returns the value of attribute details.
8 9 10 |
# File 'lib/rgen/metamodel_builder/intermediate/annotation.rb', line 8 def details @details end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
8 9 10 |
# File 'lib/rgen/metamodel_builder/intermediate/annotation.rb', line 8 def source @source end |