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



205
206
207
# File 'lib/alula/dcp/resource_attributes.rb', line 205

def date_fields
  self.class.date_fields
end

#field_namesObject



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

def field_names
  self.class.field_names
end

#fieldsObject



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

def fields
  self.class.get_fields
end

#get_typeObject



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

def get_type
  self.class.get_type
end

#persisted?Boolean



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

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

  !index.nil?
end

#to_keyObject



209
210
211
212
# File 'lib/alula/dcp/resource_attributes.rb', line 209

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

#type(arg) ⇒ Object

Instance method extensions



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

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