Sha256: feb582f578a55e469a34dc7ebe060ccd56e511289e620a8ffae5052af9c22256

Contents?: true

Size: 1.2 KB

Versions: 64

Compression:

Stored size: 1.2 KB

Contents

# encoding: UTF-8
#
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the

# LICENSE file in the root directory of this source tree.

require_relative '../types/param'
require_relative '../types/special/types'

module GoodData
  module LCM2
    module Dsl
      class TypeDsl
        def initialize
          @params = {}

          new_param
        end

        attr_reader :params

        def array_of(type)
          Type::ArrayType.new(type)
        end

        def instance_of(type)
          type.new
        end

        def new_param
          @param = Type::Param.new
        end

        def description(desc)
          @param.description = desc
        end

        def param(name, type, opts = {})
          @param.name = name
          @param.type = type
          @param.opts = opts

          @params[name] = {
            name: @param.name,
            type: @param.type,
            opts: @param.opts,
            description: @param.description,
            category: @param.type.class.const_get(:CATEGORY)
          }

          # Create new instance of param
          new_param
        end
      end
    end
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
gooddata-2.1.0-java lib/gooddata/lcm/dsl/type_dsl.rb
gooddata-2.1.0 lib/gooddata/lcm/dsl/type_dsl.rb
gooddata-2.0.1-java lib/gooddata/lcm/dsl/type_dsl.rb
gooddata-2.0.1 lib/gooddata/lcm/dsl/type_dsl.rb
gooddata-2.0.0-java lib/gooddata/lcm/dsl/type_dsl.rb
gooddata-2.0.0 lib/gooddata/lcm/dsl/type_dsl.rb
gooddata-1.3.6-java lib/gooddata/lcm/dsl/type_dsl.rb
gooddata-1.3.6 lib/gooddata/lcm/dsl/type_dsl.rb
gooddata-1.3.5-java lib/gooddata/lcm/dsl/type_dsl.rb
gooddata-1.3.5 lib/gooddata/lcm/dsl/type_dsl.rb
gooddata-1.3.4-java lib/gooddata/lcm/dsl/type_dsl.rb
gooddata-1.3.4 lib/gooddata/lcm/dsl/type_dsl.rb
gooddata-1.3.3-java lib/gooddata/lcm/dsl/type_dsl.rb
gooddata-1.3.3 lib/gooddata/lcm/dsl/type_dsl.rb
gooddata-1.3.2-java lib/gooddata/lcm/dsl/type_dsl.rb
gooddata-1.3.2 lib/gooddata/lcm/dsl/type_dsl.rb
gooddata-1.3.1-java lib/gooddata/lcm/dsl/type_dsl.rb
gooddata-1.3.1 lib/gooddata/lcm/dsl/type_dsl.rb
gooddata-1.3.0-java lib/gooddata/lcm/dsl/type_dsl.rb
gooddata-1.3.0 lib/gooddata/lcm/dsl/type_dsl.rb