Class: Mxrb::Dsl::ConstantBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/mxrb/dsl/builder.rb

Constant Summary collapse

CONSTANT_TYPES =
{
  string: "DataTypes$StringType", integer: "DataTypes$IntegerType",
  boolean: "DataTypes$BooleanType", decimal: "DataTypes$DecimalType",
  datetime: "DataTypes$DateTimeType"
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type:, value: nil) ⇒ ConstantBuilder

Returns a new instance of ConstantBuilder.



748
749
750
751
752
753
# File 'lib/mxrb/dsl/builder.rb', line 748

def initialize(name, type:, value: nil)
  @name  = name.to_s
  @type  = type.to_sym
  @value = value
  @doc   = ""
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



746
747
748
# File 'lib/mxrb/dsl/builder.rb', line 746

def name
  @name
end

Instance Method Details

#documentation(d) ⇒ Object



755
# File 'lib/mxrb/dsl/builder.rb', line 755

def documentation(d) = (@doc = d)

#to_hObject



757
758
759
# File 'lib/mxrb/dsl/builder.rb', line 757

def to_h
  { name: @name, type: @type, value: @value, documentation: @doc }
end