Sha256: bc8c7ba0cc0ff9eb967536a5662bb67bb1aad85111c4c7e572826d590874f595

Contents?: true

Size: 1.68 KB

Versions: 7

Compression:

Stored size: 1.68 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_rules
      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_rules = options[:where_rules] || []
        @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_rules,
          *informal_propositions,
          *remark_items
        ]
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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