Sha256: 2415e1af710277fd65aa829f73e8dcba5f1a920e00fc55bb7b4e42bd0bd647b4

Contents?: true

Size: 1.66 KB

Versions: 7

Compression:

Stored size: 1.66 KB

Contents

module Expressir
  module Model
    class Rule < ModelElement
      include Identifier

      model_attr_accessor :applies_to
      model_attr_accessor :types
      model_attr_accessor :entities
      model_attr_accessor :subtype_constraints
      model_attr_accessor :functions
      model_attr_accessor :procedures
      model_attr_accessor :constants
      model_attr_accessor :variables
      model_attr_accessor :statements
      model_attr_accessor :where
      model_attr_accessor :informal_propositions

      def initialize(options = {})
        @id = options[:id]
        @remarks = options[:remarks] || []
        @remark_items = options[:remark_items] || []
        @source = options[:source]

        @applies_to = options[:applies_to] || []
        @types = options[:types] || []
        @entities = options[:entities] || []
        @subtype_constraints = options[:subtype_constraints] || []
        @functions = options[:functions] || []
        @procedures = options[:procedures] || []
        @constants = options[:constants] || []
        @variables = options[:variables] || []
        @statements = options[:statements] || []
        @where = options[:where] || []
        @informal_propositions = options[:informal_propositions] || []

        super
      end

      def enumeration_items
        types.flat_map{|x| x.enumeration_items}
      end

      def children
        [
          *types,
          *enumeration_items,
          *entities,
          *subtype_constraints,
          *functions,
          *procedures,
          *constants,
          *variables,
          *where,
          *informal_propositions,
          *remark_items
        ]
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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