Class: ClusterPoint::Document
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- ClusterPoint::Document
- Extended by:
- ActiveModel::Naming, Contains, ContainsMany, FinderMethods, HashMethods
- Includes:
- ActiveModel::Conversion, ActiveModel::Validations, JsonMethods, ModificationMethods
- Defined in:
- lib/cluster_point/document.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
Methods included from FinderMethods
Methods included from HashMethods
from_array, from_hash, like_array, remove_attribs
Methods included from Contains
clear_contains, contains, get_contains
Methods included from ContainsMany
clear_contains_many, contains_many, get_contains_many
Methods included from ModificationMethods
#destroy, #merge, #save, #update
Methods included from JsonMethods
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
16 17 18 |
# File 'lib/cluster_point/document.rb', line 16 def id @id end |
#type ⇒ Object
Returns the value of attribute type.
16 17 18 |
# File 'lib/cluster_point/document.rb', line 16 def type @type end |
Class Method Details
.get_cp ⇒ Object
18 19 20 21 22 23 |
# File 'lib/cluster_point/document.rb', line 18 def self.get_cp if @cp == nil @cp = ClusterPoint::ClusterPointAdapter.new end @cp end |
.new_from_hash(hash) ⇒ Object
32 33 34 35 36 |
# File 'lib/cluster_point/document.rb', line 32 def self.new_from_hash(hash) doc=self.from_hash(hash, self) doc["type"] = self.to_s.upcase doc end |
Instance Method Details
#get_cp ⇒ Object
25 26 27 28 29 30 |
# File 'lib/cluster_point/document.rb', line 25 def get_cp if @cp == nil @cp = ClusterPoint::ClusterPointAdapter.new end @cp end |
#persisted? ⇒ Boolean
38 39 40 |
# File 'lib/cluster_point/document.rb', line 38 def persisted? id != nil end |