Class: Delta::Plucker

Inherits:
Object
  • Object
show all
Defined in:
lib/delta/plucker.rb

Defined Under Namespace

Classes: Null

Instance Method Summary collapse

Constructor Details

#initialize(pluck) ⇒ Plucker

Returns a new instance of Plucker.



3
4
5
6
# File 'lib/delta/plucker.rb', line 3

def initialize(pluck)
  self.array = pluck
  self.struct = Struct.new(*array)
end

Instance Method Details

#pluck(object) ⇒ Object



8
9
10
11
# File 'lib/delta/plucker.rb', line 8

def pluck(object)
  attributes = array.map { |k| object.public_send(k) }
  struct.new(*attributes)
end