Class: GoodData::LCM2::Dsl::ParamsDsl

Inherits:
Object
  • Object
show all
Defined in:
lib/gooddata/lcm/dsl/params_dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeParamsDsl

Returns a new instance of ParamsDsl.



14
15
16
17
18
# File 'lib/gooddata/lcm/dsl/params_dsl.rb', line 14

def initialize
  @params = {}

  new_param
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



20
21
22
# File 'lib/gooddata/lcm/dsl/params_dsl.rb', line 20

def params
  @params
end

Instance Method Details

#array_of(type) ⇒ Object



22
23
24
# File 'lib/gooddata/lcm/dsl/params_dsl.rb', line 22

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

#description(desc) ⇒ Object



34
35
36
# File 'lib/gooddata/lcm/dsl/params_dsl.rb', line 34

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

#instance_of(type) ⇒ Object



26
27
28
# File 'lib/gooddata/lcm/dsl/params_dsl.rb', line 26

def instance_of(type)
  type.new
end

#new_paramObject



30
31
32
# File 'lib/gooddata/lcm/dsl/params_dsl.rb', line 30

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

#param(name, type, opts = {}) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/gooddata/lcm/dsl/params_dsl.rb', line 38

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