Class: OrderCompatibilityValidator::OrderRequestTypes
- Inherits:
-
Object
- Object
- OrderCompatibilityValidator::OrderRequestTypes
- Defined in:
- app/validators/order_compatibility_validator.rb
Overview
A nifty little class to support the validation
Instance Attribute Summary collapse
-
#ids ⇒ Object
readonly
Returns the value of attribute ids.
-
#objects ⇒ Object
readonly
Returns the value of attribute objects.
Instance Method Summary collapse
- #for_multiplexing ⇒ Object
- #for_multiplexing? ⇒ Boolean
-
#initialize(ids = []) ⇒ OrderRequestTypes
constructor
A new instance of OrderRequestTypes.
- #not_for_multiplexing? ⇒ Boolean
- #post_for_multiplexing ⇒ Object
Constructor Details
#initialize(ids = []) ⇒ OrderRequestTypes
Returns a new instance of OrderRequestTypes.
35 36 37 38 |
# File 'app/validators/order_compatibility_validator.rb', line 35 def initialize(ids = []) @ids = ids @objects = RequestType.find(ids) end |
Instance Attribute Details
#ids ⇒ Object (readonly)
Returns the value of attribute ids.
33 34 35 |
# File 'app/validators/order_compatibility_validator.rb', line 33 def ids @ids end |
#objects ⇒ Object (readonly)
Returns the value of attribute objects.
33 34 35 |
# File 'app/validators/order_compatibility_validator.rb', line 33 def objects @objects end |
Instance Method Details
#for_multiplexing ⇒ Object
40 41 42 |
# File 'app/validators/order_compatibility_validator.rb', line 40 def for_multiplexing @for_multiplexing ||= objects.find(&:for_multiplexing?) end |
#for_multiplexing? ⇒ Boolean
44 45 46 |
# File 'app/validators/order_compatibility_validator.rb', line 44 def for_multiplexing? for_multiplexing.present? end |
#not_for_multiplexing? ⇒ Boolean
48 49 50 |
# File 'app/validators/order_compatibility_validator.rb', line 48 def not_for_multiplexing? for_multiplexing.blank? end |
#post_for_multiplexing ⇒ Object
52 53 54 55 56 |
# File 'app/validators/order_compatibility_validator.rb', line 52 def post_for_multiplexing return unless for_multiplexing? ids.split(for_multiplexing.id).last end |