Sha256: 9dc9364e873f12d90cb0dbcb3af84cc22f46be3c74c6714349ff11ed4c797ada

Contents?: true

Size: 1.23 KB

Versions: 13

Compression:

Stored size: 1.23 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'

module GoodData
  module LCM2
    module Dsl
      class ParamsDsl
        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 one_of(_type)
          Type::EnumType.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

13 entries across 13 versions & 1 rubygems

Version Path
gooddata-1.1.0-java lib/gooddata/lcm/dsl/params_dsl.rb
gooddata-1.1.0 lib/gooddata/lcm/dsl/params_dsl.rb
gooddata-1.0.2-java lib/gooddata/lcm/dsl/params_dsl.rb
gooddata-1.0.2 lib/gooddata/lcm/dsl/params_dsl.rb
gooddata-1.0.1 lib/gooddata/lcm/dsl/params_dsl.rb
gooddata-1.0.1-java lib/gooddata/lcm/dsl/params_dsl.rb
gooddata-1.0.0-java lib/gooddata/lcm/dsl/params_dsl.rb
gooddata-1.0.0 lib/gooddata/lcm/dsl/params_dsl.rb
gooddata-0.6.54 lib/gooddata/lcm/dsl/params_dsl.rb
gooddata-0.6.53 lib/gooddata/lcm/dsl/params_dsl.rb
gooddata-0.6.52 lib/gooddata/lcm/dsl/params_dsl.rb
gooddata-0.6.51 lib/gooddata/lcm/dsl/params_dsl.rb
gooddata-0.6.50 lib/gooddata/lcm/dsl/params_dsl.rb