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



133
134
135
# File 'lib/alula/dcp/resource_attributes.rb', line 133

def date_fields
  self.class.date_fields
end

#field_namesObject



121
122
123
# File 'lib/alula/dcp/resource_attributes.rb', line 121

def field_names
  self.class.field_names
end

#fieldsObject



117
118
119
# File 'lib/alula/dcp/resource_attributes.rb', line 117

def fields
  self.class.get_fields
end

#get_typeObject



113
114
115
# File 'lib/alula/dcp/resource_attributes.rb', line 113

def get_type
  self.class.get_type
end

#persisted?Boolean

Returns:

  • (Boolean)


125
126
127
128
129
# File 'lib/alula/dcp/resource_attributes.rb', line 125

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

  !index.nil?
end

#to_keyObject



137
138
139
140
# File 'lib/alula/dcp/resource_attributes.rb', line 137

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

#type(arg) ⇒ Object

Instance method extensions



109
110
111
# File 'lib/alula/dcp/resource_attributes.rb', line 109

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