Class: Ork::Model::Index
- Inherits:
-
Object
- Object
- Ork::Model::Index
- Defined in:
- lib/ork/model/index.rb
Instance Method Summary collapse
-
#initialize(name, type = 'bin') ⇒ Index
constructor
A new instance of Index.
-
#riak_name ⇒ Object
Index name in riak format.
-
#value_from(attributes) ⇒ Object
Take the attributes needed by the index.
Constructor Details
#initialize(name, type = 'bin') ⇒ Index
Returns a new instance of Index.
4 5 6 |
# File 'lib/ork/model/index.rb', line 4 def initialize(name, type = 'bin') @name, @type = name, type end |
Instance Method Details
#riak_name ⇒ Object
Index name in riak format
9 10 11 |
# File 'lib/ork/model/index.rb', line 9 def riak_name "#@name\_#@type" end |
#value_from(attributes) ⇒ Object
Take the attributes needed by the index. It’s best to normalize or encode any user-supplied data before using it as an index
16 17 18 |
# File 'lib/ork/model/index.rb', line 16 def value_from(attributes) Array(attributes[@name]).to_set end |