Class: AdfBuilder::Nodes::Condition
- 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
-
#initialize(value) ⇒ Condition
constructor
A new instance of Condition.
Methods inherited from Node
#add_child, #method_missing, #remove_children, #respond_to_missing?, #to_xml
Methods included from Validations
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