Class: AdfBuilder::Nodes::FinanceMethod
- Defined in:
- lib/adf_builder/nodes/vehicle_nodes.rb
Constant Summary collapse
- VALID_VALUES =
%w[cash finance lease].freeze
Instance Attribute Summary
Attributes inherited from Node
#attributes, #children, #tag_name, #value
Instance Method Summary collapse
-
#initialize(value) ⇒ FinanceMethod
constructor
A new instance of FinanceMethod.
Methods inherited from Node
#add_child, #method_missing, #remove_children, #respond_to_missing?, #to_xml
Methods included from Validations
Constructor Details
#initialize(value) ⇒ FinanceMethod
Returns a new instance of FinanceMethod.
59 60 61 62 63 64 65 66 67 |
# File 'lib/adf_builder/nodes/vehicle_nodes.rb', line 59 def initialize(value) super() @tag_name = :method unless VALID_VALUES.include?(value.to_s.downcase) raise AdfBuilder::Error, "Invalid finance method: #{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