Class: AdfBuilder::Nodes::Weighting

Inherits:
Node
  • Object
show all
Defined in:
lib/adf_builder/nodes/vehicle_nodes.rb

Instance Attribute Summary

Attributes inherited from Node

#attributes, #children, #tag_name, #value

Instance Method Summary collapse

Methods inherited from Node

#add_child, #method_missing, #remove_children, #respond_to_missing?, #to_xml

Methods included from Validations

included, #validate!

Constructor Details

#initialize(value) ⇒ Weighting

Returns a new instance of Weighting.



44
45
46
47
48
49
50
51
52
53
# File 'lib/adf_builder/nodes/vehicle_nodes.rb', line 44

def initialize(value)
  super()
  @tag_name = :weighting
  int_val = value.to_i
  unless int_val.between?(-100, 100)
    raise AdfBuilder::Error, "Weighting must be between -100 and 100. Got: #{value}"
  end

  @value = value
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class AdfBuilder::Nodes::Node