Class: Delta::Plucker
- Inherits:
-
Object
- Object
- Delta::Plucker
- Defined in:
- lib/delta/plucker.rb
Defined Under Namespace
Classes: Null
Instance Method Summary collapse
-
#initialize(pluck) ⇒ Plucker
constructor
A new instance of Plucker.
- #pluck(object) ⇒ Object
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 |