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



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

def date_fields
  self.class.date_fields
end

#field_namesObject



189
190
191
# File 'lib/alula/resource_attributes.rb', line 189

def field_names
  self.class.field_names
end

#fieldsObject



185
186
187
# File 'lib/alula/resource_attributes.rb', line 185

def fields
  self.class.fields
end

#get_typeObject



181
182
183
# File 'lib/alula/resource_attributes.rb', line 181

def get_type
  self.class.get_type
end

#persisted?Boolean

Returns:

  • (Boolean)


193
194
195
# File 'lib/alula/resource_attributes.rb', line 193

def persisted?
  !self.id.nil?
end

#read_only_attributesObject



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

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

#resource_pathObject

Instance method extensions



173
174
175
# File 'lib/alula/resource_attributes.rb', line 173

def resource_path
  self.class.resource_path
end

#to_keyObject



207
208
209
210
# File 'lib/alula/resource_attributes.rb', line 207

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

#type(arg) ⇒ Object



177
178
179
# File 'lib/alula/resource_attributes.rb', line 177

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