Module: EmbeddedRecord::Record

Defined in:
lib/embedded_record.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



137
138
139
140
# File 'lib/embedded_record.rb', line 137

def self.included(klass)
  klass.extend ClassMethods
  klass.attribute :id
end

Instance Method Details

#indexObject

Returns Integer index of the record in the records set



150
151
152
# File 'lib/embedded_record.rb', line 150

def index
  self.class.all.index(self)
end

#is?(id) ⇒ Boolean

Returns true if record’s id is the same as argument or false otherwise

Returns:

  • (Boolean)


144
145
146
# File 'lib/embedded_record.rb', line 144

def is?(id)
  self.id == id
end