Sha256: 12a8289de0dd59e539aeae325e2d0d9b047b3284a6cc85963aa55bcf9aa6bc22

Contents?: true

Size: 1.33 KB

Versions: 7

Compression:

Stored size: 1.33 KB

Contents

module Expressir
  module Model
    class Entity
      include Scope
      include Identifier

      attr_accessor :abstract
      attr_accessor :supertype_expression
      attr_accessor :subtype_of
      attr_accessor :attributes
      attr_accessor :unique
      attr_accessor :where
      attr_accessor :informal_propositions

      def initialize(options = {})
        @id = options[:id]

        @abstract = options[:abstract]
        @supertype_expression = options[:supertype_expression]
        @subtype_of = options[:subtype_of]
        @attributes = options[:attributes]
        @unique = options[:unique]
        @where = options[:where]
        @informal_propositions = options[:informal_propositions]
      end

      def explicit_attributes
        @attributes.select{|x| x.kind == Expressir::Model::Attribute::EXPLICIT}
      end

      def derived_attributes
        @attributes.select{|x| x.kind == Expressir::Model::Attribute::DERIVED}
      end

      def inverse_attributes
        @attributes.select{|x| x.kind == Expressir::Model::Attribute::INVERSE}
      end

      def children
        items = []
        items.push(*@attributes) if @attributes
        items.push(*@unique) if @unique
        items.push(*@where) if @where
        items.push(*@informal_propositions) if @informal_propositions
        items
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
expressir-0.2.9 lib/expressir/model/entity.rb
expressir-0.2.9-x86_64-linux lib/expressir/model/entity.rb
expressir-0.2.9-x86_64-darwin lib/expressir/model/entity.rb
expressir-0.2.9-x86-mingw32 lib/expressir/model/entity.rb
expressir-0.2.9-x86-linux lib/expressir/model/entity.rb
expressir-0.2.9-x64-mingw32 lib/expressir/model/entity.rb
expressir-0.2.9-arm64-darwin lib/expressir/model/entity.rb