Module: Hypostasis::DataModels::ForIndexes
- Included in:
- ColumnGroup, Document
- Defined in:
- lib/hypostasis/data_models/for_indexes.rb
Instance Method Summary collapse
Instance Method Details
#for_index(object, field_name, value) ⇒ Object
2 3 4 5 6 7 8 9 10 11 |
# File 'lib/hypostasis/data_models/for_indexes.rb', line 2 def for_index(object, field_name, value) index_path = Hypostasis::Tuple.new('indexes', get_class_name(object)).to_s value = value.to_s unless value.is_a?(Fixnum) || value.is_a?(Bignum) if object.is_a?(Class) field_path = Hypostasis::Tuple.new(field_name.to_s, value).to_s else field_path = Hypostasis::Tuple.new(field_name.to_s, value, object.id.to_s).to_s end name.to_s + '\\' + index_path + '\\' + field_path end |