Class: Ork::Model::Index

Inherits:
Object
  • Object
show all
Defined in:
lib/ork/model/index.rb

Instance Method Summary collapse

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_nameObject

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)
  Set[attributes[@name]]
end