Sha256: 2bd5d792150497329896555e73321e75931513303fb2b2ca5020ec4e44f89890

Contents?: true

Size: 1.15 KB

Versions: 18

Compression:

Stored size: 1.15 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

      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]
      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
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
expressir-0.2.8 lib/expressir/model/entity.rb
expressir-0.2.8-x86_64-linux lib/expressir/model/entity.rb
expressir-0.2.8-x86_64-darwin lib/expressir/model/entity.rb
expressir-0.2.8-x86-mingw32 lib/expressir/model/entity.rb
expressir-0.2.8-x86-linux lib/expressir/model/entity.rb
expressir-0.2.8-x64-mingw32 lib/expressir/model/entity.rb
expressir-0.2.8-arm64-darwin lib/expressir/model/entity.rb
expressir-0.2.7 lib/expressir/model/entity.rb
expressir-0.2.7-x86-mingw32 lib/expressir/model/entity.rb
expressir-0.2.7-x64-mingw32 lib/expressir/model/entity.rb
expressir-0.2.7-x86_64-linux lib/expressir/model/entity.rb
expressir-0.2.7-x86-linux lib/expressir/model/entity.rb
expressir-0.2.7-x86_64-darwin lib/expressir/model/entity.rb
expressir-0.2.7-arm64-darwin lib/expressir/model/entity.rb
expressir-0.2.5-x86_64-linux lib/expressir/model/entity.rb
expressir-0.2.5-x86_64-darwin-19 lib/expressir/model/entity.rb
expressir-0.2.5 lib/expressir/model/entity.rb
expressir-0.2.4 lib/expressir/model/entity.rb