Class: GoodData::LCM2::Dsl::TypeDsl
- Defined in:
- lib/gooddata/lcm/dsl/type_dsl.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #array_of(type) ⇒ Object
- #description(desc) ⇒ Object
-
#initialize ⇒ TypeDsl
constructor
A new instance of TypeDsl.
- #instance_of(type) ⇒ Object
- #new_param ⇒ Object
- #param(name, type, opts = {}) ⇒ Object
Constructor Details
#initialize ⇒ TypeDsl
Returns a new instance of TypeDsl.
15 16 17 18 19 |
# File 'lib/gooddata/lcm/dsl/type_dsl.rb', line 15 def initialize @params = {} new_param end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
21 22 23 |
# File 'lib/gooddata/lcm/dsl/type_dsl.rb', line 21 def params @params end |
Instance Method Details
#array_of(type) ⇒ Object
23 24 25 |
# File 'lib/gooddata/lcm/dsl/type_dsl.rb', line 23 def array_of(type) Type::ArrayType.new(type) end |
#description(desc) ⇒ Object
35 36 37 |
# File 'lib/gooddata/lcm/dsl/type_dsl.rb', line 35 def description(desc) @param.description = desc end |
#instance_of(type) ⇒ Object
27 28 29 |
# File 'lib/gooddata/lcm/dsl/type_dsl.rb', line 27 def instance_of(type) type.new end |
#new_param ⇒ Object
31 32 33 |
# File 'lib/gooddata/lcm/dsl/type_dsl.rb', line 31 def new_param @param = Type::Param.new end |
#param(name, type, opts = {}) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/gooddata/lcm/dsl/type_dsl.rb', line 39 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 |