Sha256: 206daca1fb7a7327ee0851cf14ef6cf8db65e862ffd500c8d52ea70a0f1eece6

Contents?: true

Size: 1.66 KB

Versions: 21

Compression:

Stored size: 1.66 KB

Contents

module Expressir
  module Model
    class Rule < ModelElement
      include Identifier

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

      def initialize(options = {})
        @id = options[:id]
        @remarks = options.fetch(:remarks, [])
        @source = options[:source]

        @applies_to = options.fetch(:applies_to, [])
        @types = options.fetch(:types, [])
        @entities = options.fetch(:entities, [])
        @subtype_constraints = options.fetch(:subtype_constraints, [])
        @functions = options.fetch(:functions, [])
        @procedures = options.fetch(:procedures, [])
        @constants = options.fetch(:constants, [])
        @variables = options.fetch(:variables, [])
        @statements = options.fetch(:statements, [])
        @where = options.fetch(:where, [])
        @informal_propositions = options.fetch(:informal_propositions, [])

        super
      end

      def children
        items = []
        items.push(*@types)
        items.push(*@types.flat_map{|x| x.type.is_a?(Expressir::Model::Types::Enumeration) ? x.type.items : []})
        items.push(*@entities)
        items.push(*@subtype_constraints)
        items.push(*@functions)
        items.push(*@procedures)
        items.push(*@constants)
        items.push(*@variables)
        items.push(*@where)
        items.push(*@informal_propositions)
        items
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

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