Class: AdfBuilder::Nodes::Condition

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

Constant Summary collapse

VALID_VALUES =
%w[excellent good fair poor unknown].freeze

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) ⇒ Condition

Returns a new instance of Condition.



32
33
34
35
36
37
38
39
40
# File 'lib/adf_builder/nodes/vehicle_nodes.rb', line 32

def initialize(value)
  super()
  @tag_name = :condition
  unless VALID_VALUES.include?(value.to_s.downcase)
    raise AdfBuilder::Error, "Invalid condition: #{value}. Must be one of: #{VALID_VALUES.join(", ")}"
  end

  @value = value
end

Dynamic Method Handling

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