Class: InOrder::Aux::PolyFind

Inherits:
Object
  • Object
show all
Defined in:
app/models/in_order/aux/poly_find.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ PolyFind

Returns a new instance of PolyFind.



7
8
9
10
11
# File 'app/models/in_order/aux/poly_find.rb', line 7

def initialize(*args)
  self.poly_key = args.first if InOrder::Aux::PolyKey === args.first

  self.poly_key ||= PolyKey.new(*args)
end

Instance Attribute Details

#poly_keyObject

Returns the value of attribute poly_key.



5
6
7
# File 'app/models/in_order/aux/poly_find.rb', line 5

def poly_key
  @poly_key
end

Class Method Details

.call(keys) ⇒ Object



17
18
19
20
# File 'app/models/in_order/aux/poly_find.rb', line 17

def self.call(keys)
  (keys || []).map {|key| new(key).call }
    .compact
end

Instance Method Details

#callObject



13
14
15
# File 'app/models/in_order/aux/poly_find.rb', line 13

def call
  poly_key.type.constantize.find poly_key.id if poly_key.valid?
end