Sha256: 2e442c81bde981f568b1c94f05811c96e90bf9edcb4225007a016d7e1f74b494

Contents?: true

Size: 1.61 KB

Versions: 14

Compression:

Stored size: 1.61 KB

Contents

module Expressir
  module Model
    class Function < ModelElement
      include Scope
      include Identifier

      attr_accessor :parameters
      attr_accessor :return_type
      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

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

        @parameters = options.fetch(:parameters, [])
        @return_type = options[:return_type]
        @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, [])
      end

      def children
        items = []
        items.push(*@parameters)
        items.push(*@types)
        items.push(*@types.flat_map do |x|
          if x.type.instance_of? Expressir::Model::Types::Enumeration
            x.type.items
          else
            []
          end
        end)
        items.push(*@entities)
        items.push(*@subtype_constraints)
        items.push(*@functions)
        items.push(*@procedures)
        items.push(*@constants)
        items.push(*@variables)
        items
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
expressir-0.2.11 lib/expressir/model/function.rb
expressir-0.2.11-x86_64-linux lib/expressir/model/function.rb
expressir-0.2.11-x86_64-darwin lib/expressir/model/function.rb
expressir-0.2.11-x86-mingw32 lib/expressir/model/function.rb
expressir-0.2.11-x86-linux lib/expressir/model/function.rb
expressir-0.2.11-x64-mingw32 lib/expressir/model/function.rb
expressir-0.2.11-arm64-darwin lib/expressir/model/function.rb
expressir-0.2.10 lib/expressir/model/function.rb
expressir-0.2.10-x86_64-linux lib/expressir/model/function.rb
expressir-0.2.10-x86_64-darwin lib/expressir/model/function.rb
expressir-0.2.10-x86-mingw32 lib/expressir/model/function.rb
expressir-0.2.10-x86-linux lib/expressir/model/function.rb
expressir-0.2.10-x64-mingw32 lib/expressir/model/function.rb
expressir-0.2.10-arm64-darwin lib/expressir/model/function.rb