Class: Quandl::Cassandra::Models::Column::Read::Row
- Inherits:
-
Quandl::Cassandra::Models::Column::Read
- Object
- Strategy::Strategize
- Quandl::Cassandra::Models::Column::Read
- Quandl::Cassandra::Models::Column::Read::Row
- Defined in:
- lib/quandl/cassandra/models/column/read/row.rb
Instance Method Summary collapse
Methods inherited from Quandl::Cassandra::Models::Column::Read
#column_collapses, #column_ids, #column_ids=, #count?, perform
Instance Method Details
#perform ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/quandl/cassandra/models/column/read/row.rb', line 3 def perform return unless attributes[:row].present? # ensure integer row = attributes[:row] # negative value needs inversion if row < 0 attributes[:order] = :asc attributes[:offset] = (row * -1) - 1 attributes[:limit] = 1 # postive value is an offset of current observation else attributes[:order] = :desc attributes[:offset] = row attributes[:limit] = 1 end end |