Sha256: c3c3f6a9b6c185bd5769d26a407aba79a3a8f1782f2a7e009e88009db2fb286c

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

module Expressir
  module Model
    class Schema
      attr_accessor :id
      attr_accessor :version
      attr_accessor :interfaces
      attr_accessor :constants
      attr_accessor :declarations
      attr_accessor :rules

      def initialize(options = {})
        @id = options[:id]
        @version = options[:version]
        @interfaces = options[:interfaces]
        @constants = options[:constants]
        @declarations = options[:declarations]
        @rules = options[:rules]
      end

      def types
        @declarations.select{|x| x.instance_of? Expressir::Model::Type}
      end

      def entities
        @declarations.select{|x| x.instance_of? Expressir::Model::Entity}
      end

      def subtype_constraints
        @declarations.select{|x| x.instance_of? Expressir::Model::SubtypeConstraint}
      end

      def functions
        @declarations.select{|x| x.instance_of? Expressir::Model::Function}
      end

      def procedures
        @declarations.select{|x| x.instance_of? Expressir::Model::Procedure}
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
expressir-0.2.0 lib/expressir/model/schema.rb