module Elasticsearch::Persistence::Model::Base::InstanceMethods

Public Class Methods

new(attributes = {}) click to toggle source

Model initializer sets the ‘@id` variable if passed

Calls superclass method
# File lib/elasticsearch/persistence/model/base.rb, line 11
def initialize(attributes = {})
  @_id = attributes[:id] || attributes["id"]
  super
end

Public Instance Methods

_id()
Alias for: id
_id=(value)
Alias for: id=
_index() click to toggle source

Return the document ‘_index`

# File lib/elasticsearch/persistence/model/base.rb, line 40
def _index
  @_index
end
_type() click to toggle source

Return the document ‘_type`

# File lib/elasticsearch/persistence/model/base.rb, line 46
def _type
  @_type
end
_version() click to toggle source

Return the document ‘_version`

# File lib/elasticsearch/persistence/model/base.rb, line 52
def _version
  @_version
end
attributes() click to toggle source

Return model attributes as a Hash, merging in the ‘id`

Calls superclass method
# File lib/elasticsearch/persistence/model/base.rb, line 18
def attributes
  super.merge id: id
end
id() click to toggle source

Return the document ‘_id`

# File lib/elasticsearch/persistence/model/base.rb, line 24
def id
  @_id
end
Also aliased as: _id
id=(value) click to toggle source

Set the document ‘_id`

# File lib/elasticsearch/persistence/model/base.rb, line 32
def id=(value)
  @_id = value
end
Also aliased as: _id=
inspect()
Alias for: to_s
to_s() click to toggle source
# File lib/elasticsearch/persistence/model/base.rb, line 60
def to_s
  "#<#{self.class} #{attributes.to_hash.inspect.gsub(/:(\w+)=>/, '\1: ')}>"
end
Also aliased as: inspect