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
-
#date_fields ⇒ Object
Return the names of each field configured as a date type.
- #field_names ⇒ Object
- #fields ⇒ Object
- #get_type ⇒ Object
- #persisted? ⇒ Boolean
- #read_only_attributes ⇒ Object
-
#resource_path ⇒ Object
Instance method extensions.
- #to_key ⇒ Object
- #type(arg) ⇒ Object
Instance Method Details
#date_fields ⇒ Object
Return the names of each field configured as a date type
197 198 199 |
# File 'lib/alula/resource_attributes.rb', line 197 def date_fields self.class.date_fields end |
#field_names ⇒ Object
183 184 185 |
# File 'lib/alula/resource_attributes.rb', line 183 def field_names self.class.field_names end |
#fields ⇒ Object
179 180 181 |
# File 'lib/alula/resource_attributes.rb', line 179 def fields self.class.fields end |
#get_type ⇒ Object
175 176 177 |
# File 'lib/alula/resource_attributes.rb', line 175 def get_type self.class.get_type end |
#persisted? ⇒ Boolean
187 188 189 |
# File 'lib/alula/resource_attributes.rb', line 187 def persisted? !self.id.nil? end |
#read_only_attributes ⇒ Object
191 192 193 |
# File 'lib/alula/resource_attributes.rb', line 191 def read_only_attributes self.class.read_only_attributes(persisted?) end |
#resource_path ⇒ Object
Instance method extensions
167 168 169 |
# File 'lib/alula/resource_attributes.rb', line 167 def resource_path self.class.resource_path end |
#to_key ⇒ Object
201 202 203 204 |
# File 'lib/alula/resource_attributes.rb', line 201 def to_key key = respond_to?(:id) && id key ? [key] : nil end |
#type(arg) ⇒ Object
171 172 173 |
# File 'lib/alula/resource_attributes.rb', line 171 def type(arg) self.class.type(arg) end |