Module: Alula::Dcp::ResourceAttributes::InstanceMethods

Defined in:
lib/alula/dcp/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



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

def date_fields
  self.class.date_fields
end

#field_namesObject



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

def field_names
  self.class.field_names
end

#fieldsObject



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

def fields
  self.class.get_fields
end

#get_typeObject



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

def get_type
  self.class.get_type
end

#persisted?Boolean

Returns:

  • (Boolean)


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

def persisted?
  return false unless respond_to?(:index)

  !index.nil?
end

#to_keyObject



211
212
213
214
# File 'lib/alula/dcp/resource_attributes.rb', line 211

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

#type(arg) ⇒ Object

Instance method extensions



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

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