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_fields ⇒ Object

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_names ⇒ Object



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

def field_names
  self.class.field_names
end

#fields ⇒ Object



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

def fields
  self.class.fields
end

#get_type ⇒ Object



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_attributes ⇒ Object



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

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

#resource_path ⇒ Object

Instance method extensions



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

def resource_path
  self.class.resource_path
end

#to_key ⇒ Object



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