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



195
196
197
# File 'lib/alula/resource_attributes.rb', line 195

def date_fields
  self.class.date_fields
end

#field_namesObject



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

def field_names
  self.class.field_names
end

#fieldsObject



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

def fields
  self.class.fields
end

#get_typeObject



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

def get_type
  self.class.get_type
end

#persisted?Boolean

Returns:

  • (Boolean)


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

def persisted?
  !self.id.nil?
end

#read_only_attributesObject



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

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

#resource_pathObject

Instance method extensions



165
166
167
# File 'lib/alula/resource_attributes.rb', line 165

def resource_path
  self.class.resource_path
end

#to_keyObject



199
200
201
202
# File 'lib/alula/resource_attributes.rb', line 199

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

#type(arg) ⇒ Object



169
170
171
# File 'lib/alula/resource_attributes.rb', line 169

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