Module: Shameless::Model::InstanceMethods

Defined in:
lib/shameless/model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#uuidObject (readonly)

Returns the value of attribute uuid.



108
109
110
# File 'lib/shameless/model.rb', line 108

def uuid
  @uuid
end

Instance Method Details

#[](field) ⇒ Object



119
120
121
# File 'lib/shameless/model.rb', line 119

def [](field)
  base[field]
end

#[]=(field, value) ⇒ Object



123
124
125
# File 'lib/shameless/model.rb', line 123

def []=(field, value)
  base[field] = value
end

#as_jsonObject



155
156
157
# File 'lib/shameless/model.rb', line 155

def as_json(*)
  base.as_json
end

#baseObject



115
116
117
# File 'lib/shameless/model.rb', line 115

def base
  @cells[Cell::BASE]
end

#cellsObject



163
164
165
# File 'lib/shameless/model.rb', line 163

def cells
  @cells.values
end

#created_atObject



139
140
141
# File 'lib/shameless/model.rb', line 139

def created_at
  base.created_at
end

#fetch(key, default) ⇒ Object



147
148
149
# File 'lib/shameless/model.rb', line 147

def fetch(key, default)
  base.fetch(key, default)
end

#fetch_cell(cell_name, ref_key = nil) ⇒ Object



171
172
173
# File 'lib/shameless/model.rb', line 171

def fetch_cell(cell_name, ref_key = nil)
 self.class.fetch_cell(shardable_value, uuid, cell_name, ref_key)
end

#initialize(uuid, base_body = nil) ⇒ Object



110
111
112
113
# File 'lib/shameless/model.rb', line 110

def initialize(uuid, base_body = nil)
  @uuid = uuid
  @cells = {Cell::BASE => Cell.base(self, base_body)}
end

#present?Boolean

Returns:

  • (Boolean)


151
152
153
# File 'lib/shameless/model.rb', line 151

def present?
  base.present?
end

#prevent_readonly_attribute_mutation!(key) ⇒ Object



175
176
177
# File 'lib/shameless/model.rb', line 175

def prevent_readonly_attribute_mutation!(key)
  self.class.prevent_readonly_attribute_mutation!(key)
end

#previousObject



143
144
145
# File 'lib/shameless/model.rb', line 143

def previous
  base.previous
end

#put_cell(cell_values) ⇒ Object



167
168
169
# File 'lib/shameless/model.rb', line 167

def put_cell(cell_values)
  self.class.put_cell(shardable_value, cell_values)
end

#ref_keyObject



135
136
137
# File 'lib/shameless/model.rb', line 135

def ref_key
  base.ref_key
end

#reloadObject



159
160
161
# File 'lib/shameless/model.rb', line 159

def reload
  cells.each(&:reload)
end

#saveObject



131
132
133
# File 'lib/shameless/model.rb', line 131

def save
  base.save
end

#update(values) ⇒ Object



127
128
129
# File 'lib/shameless/model.rb', line 127

def update(values)
  base.update(values)
end