Sha256: 93e001d68c02b1b7b32158379f8c295f0e97a8a2083de07c38dfc1325bcf9684

Contents?: true

Size: 1.26 KB

Versions: 8

Compression:

Stored size: 1.26 KB

Contents

require 'rgen/metamodel_builder'

module HouseMetamodel
   extend RGen::MetamodelBuilder::ModuleExtension
   include RGen::MetamodelBuilder::DataTypes

   SexEnum = Enum.new(:name => 'SexEnum', :literals =>[ :male, :female ])

   class House < RGen::MetamodelBuilder::MMBase
      annotation :source => "bla", :details => {'a' => 'b'}
      has_attr 'address', String, :changeable => false 
   end

   class MeetingPlace < RGen::MetamodelBuilder::MMBase
   end

   class Person < RGen::MetamodelBuilder::MMBase
      has_attr 'sex', HouseMetamodel::SexEnum 
   end


   module Rooms
      extend RGen::MetamodelBuilder::ModuleExtension
      include RGen::MetamodelBuilder::DataTypes


      class Room < RGen::MetamodelBuilder::MMBase
      end

      class Bathroom < Room
      end

      class Kitchen < RGen::MetamodelBuilder::MMMultiple(Room, HouseMetamodel::MeetingPlace)
      end

   end
end

HouseMetamodel::House.has_one 'bathroom', HouseMetamodel::Rooms::Bathroom, :lowerBound => 1 
HouseMetamodel::House.one_to_one 'kitchen', HouseMetamodel::Rooms::Kitchen, 'house', :lowerBound => 1 
HouseMetamodel::House.contains_many 'room', HouseMetamodel::Rooms::Room, 'house' 
HouseMetamodel::Person.has_many 'house', HouseMetamodel::House 

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rgen-0.5.1 test/metamodel_roundtrip_test/houseMetamodel_from_ecore.rb
rgen-0.4.2 test/metamodel_roundtrip_test/houseMetamodel_from_ecore.rb
rgen-0.4.1 test/metamodel_roundtrip_test/houseMetamodel_from_ecore.rb
rgen-0.4.5 test/metamodel_roundtrip_test/houseMetamodel_from_ecore.rb
rgen-0.4.6 test/metamodel_roundtrip_test/houseMetamodel_from_ecore.rb
rgen-0.5.0 test/metamodel_roundtrip_test/houseMetamodel_from_ecore.rb
rgen-0.4.3 test/metamodel_roundtrip_test/houseMetamodel_from_ecore.rb
rgen-0.4.4 test/metamodel_roundtrip_test/houseMetamodel_from_ecore.rb