Sha256: cef728c5299de96443b7ad55ae8cbfa3fe23886fada700cff87483e27a69f359
Contents?: true
Size: 924 Bytes
Versions: 2
Compression:
Stored size: 924 Bytes
Contents
module Tagliani class Search class Index class Object def initialize(object = {}) @object = object.is_a?(Hash) ? object.stringify_keys : JSON.parse(object) end def id "#{@object['object_kls'].to_s.downcase}_#{@object['object_id']}_#{@object['tag_id']}" end def to_h { object_kls: @object['object_kls'], object_id: @object['object_id'], object_created_at: @object['created_at'].try(:strftime, '%Y-%m-%d %H:%M:%S'), tag_id: @object['tag_id'], tag_kls: @object['tag_kls'], tag_type: @object['tag_type'], tag_name: @object['tag_name'], last_updated: @object['last_updated'].try(:strftime, '%Y-%m-%d %H:%M:%S') } end def to_json to_h.to_json end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tagliani-0.1.1 | lib/tagliani/search/index/object.rb |
tagliani-0.1.0 | lib/tagliani/search/index/object.rb |