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.



667
668
669
670
671
672
# File 'lib/mxrb/dsl/builder.rb', line 667

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.



665
666
667
# File 'lib/mxrb/dsl/builder.rb', line 665

def name
  @name
end

Instance Method Details

#documentation(d) ⇒ Object



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

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

#to_hObject



676
677
678
# File 'lib/mxrb/dsl/builder.rb', line 676

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