Class: OrderCompatibilityValidator::OrderRequestTypes

Inherits:
Object
  • Object
show all
Defined in:
app/validators/order_compatibility_validator.rb

Overview

A nifty little class to support the validation

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#idsObject (readonly)

Returns the value of attribute ids.



33
34
35
# File 'app/validators/order_compatibility_validator.rb', line 33

def ids
  @ids
end

#objectsObject (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_multiplexingObject



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

Returns:

  • (Boolean)


44
45
46
# File 'app/validators/order_compatibility_validator.rb', line 44

def for_multiplexing?
  for_multiplexing.present?
end

#not_for_multiplexing?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'app/validators/order_compatibility_validator.rb', line 48

def not_for_multiplexing?
  for_multiplexing.blank?
end

#post_for_multiplexingObject



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