Class: FreightKit::Tariff
- Inherits:
-
Object
- Object
- FreightKit::Tariff
- Defined in:
- lib/freight_kit/tariff.rb,
lib/freight_kit/tariff/overlength_rule.rb
Defined Under Namespace
Classes: OverlengthRule
Instance Attribute Summary collapse
-
#overlength_rules ⇒ Object
Returns the value of attribute overlength_rules.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Tariff
constructor
A new instance of Tariff.
Constructor Details
#initialize(options = {}) ⇒ Tariff
Returns a new instance of Tariff.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/freight_kit/tariff.rb', line 7 def initialize( = {}) .symbolize_keys! @options = overlength_rules = [:overlength_rules].presence || [] raise ArgumentError, 'overlength_rules must be an Array' unless overlength_rules.is_a?(Array) @overlength_rules = overlength_rules.map do |overlength_rule| overlength_rule.is_a?(OverlengthRule) ? overlength_rule : OverlengthRule.new(**overlength_rule) end end |
Instance Attribute Details
#overlength_rules ⇒ Object
Returns the value of attribute overlength_rules.
5 6 7 |
# File 'lib/freight_kit/tariff.rb', line 5 def overlength_rules @overlength_rules end |