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



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

def date_fields
  self.class.date_fields
end

#field_namesObject



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

def field_names
  self.class.field_names
end

#fieldsObject



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

def fields
  self.class.fields
end

#get_typeObject



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

def get_type
  self.class.get_type
end

#persisted?Boolean

Returns:

  • (Boolean)


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

def persisted?
  !self.id.nil?
end

#read_only_attributesObject



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

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

#resource_pathObject

Instance method extensions



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

def resource_path
  self.class.resource_path
end

#to_keyObject



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

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

#type(arg) ⇒ Object



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

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