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



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

def date_fields
  self.class.date_fields
end

#field_namesObject



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

def field_names
  self.class.field_names
end

#fieldsObject



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

def fields
  self.class.fields
end

#get_typeObject



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

def get_type
  self.class.get_type
end

#persisted?Boolean

Returns:

  • (Boolean)


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

def persisted?
  !self.id.nil?
end

#read_only_attributesObject



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

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

#resource_pathObject

Instance method extensions



163
164
165
# File 'lib/alula/resource_attributes.rb', line 163

def resource_path
  self.class.resource_path
end

#to_keyObject



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

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

#type(arg) ⇒ Object



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

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