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
-
#date_fields ⇒ Object
Return the names of each field configured as a date type.
- #field_names ⇒ Object
- #fields ⇒ Object
- #get_type ⇒ Object
- #persisted? ⇒ Boolean
- #to_key ⇒ Object
-
#type(arg) ⇒ Object
Instance method extensions.
Instance Method Details
#date_fields ⇒ Object
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_names ⇒ Object
121 122 123 |
# File 'lib/alula/dcp/resource_attributes.rb', line 121 def field_names self.class.field_names end |
#fields ⇒ Object
117 118 119 |
# File 'lib/alula/dcp/resource_attributes.rb', line 117 def fields self.class.get_fields end |
#get_type ⇒ Object
113 114 115 |
# File 'lib/alula/dcp/resource_attributes.rb', line 113 def get_type self.class.get_type end |
#persisted? ⇒ 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_key ⇒ Object
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 |