Module: WingedCouch::Models::Attributes

Included in:
WingedCouch::Model
Defined in:
lib/winged_couch/models/attributes.rb

Overview

Module for defining model attributes

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object


8
9
10
# File 'lib/winged_couch/models/attributes.rb', line 8

def self.included(klass)
  klass.extend ClassMethods
end

Instance Method Details

#attributesHash

Returns hash of attributes in format { key: value }


72
73
74
# File 'lib/winged_couch/models/attributes.rb', line 72

def attributes
  Hash[self.class.attribute_names.map { |attr_name| [attr_name, send(attr_name)] }]
end

#native_documentObject

Returns native


64
65
66
# File 'lib/winged_couch/models/attributes.rb', line 64

def native_document
  @native_document ||= Native::Document.new(self.class.database)
end