Module: Alula::ResourceAttributes::InstanceMethods

Defined in:
lib/alula/resource_attributes.rb

Overview

Extensions to allow instances to get at their class config, either raw or reduced to a useable format for a specific task.

Instance Method Summary collapse

Instance Method Details

#date_fieldsObject

Return the names of each field configured as a date type



197
198
199
# File 'lib/alula/resource_attributes.rb', line 197

def date_fields
  self.class.date_fields
end

#field_namesObject



183
184
185
# File 'lib/alula/resource_attributes.rb', line 183

def field_names
  self.class.field_names
end

#fieldsObject



179
180
181
# File 'lib/alula/resource_attributes.rb', line 179

def fields
  self.class.fields
end

#get_typeObject



175
176
177
# File 'lib/alula/resource_attributes.rb', line 175

def get_type
  self.class.get_type
end

#persisted?Boolean

Returns:

  • (Boolean)


187
188
189
# File 'lib/alula/resource_attributes.rb', line 187

def persisted?
  !self.id.nil?
end

#read_only_attributesObject



191
192
193
# File 'lib/alula/resource_attributes.rb', line 191

def read_only_attributes
  self.class.read_only_attributes(persisted?)
end

#resource_pathObject

Instance method extensions



167
168
169
# File 'lib/alula/resource_attributes.rb', line 167

def resource_path
  self.class.resource_path
end

#to_keyObject



201
202
203
204
# File 'lib/alula/resource_attributes.rb', line 201

def to_key
  key = respond_to?(:id) && id
  key ? [key] : nil
end

#type(arg) ⇒ Object



171
172
173
# File 'lib/alula/resource_attributes.rb', line 171

def type(arg)
  self.class.type(arg)
end