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
196 197 198 |
# File 'lib/alula/resource_attributes.rb', line 196 def date_fields self.class.date_fields end |
#field_names ⇒ Object
182 183 184 |
# File 'lib/alula/resource_attributes.rb', line 182 def field_names self.class.field_names end |
#fields ⇒ Object
178 179 180 |
# File 'lib/alula/resource_attributes.rb', line 178 def fields self.class.fields end |
#get_type ⇒ Object
174 175 176 |
# File 'lib/alula/resource_attributes.rb', line 174 def get_type self.class.get_type end |
#persisted? ⇒ Boolean
186 187 188 |
# File 'lib/alula/resource_attributes.rb', line 186 def persisted? !self.id.nil? end |
#read_only_attributes ⇒ Object
190 191 192 |
# File 'lib/alula/resource_attributes.rb', line 190 def read_only_attributes self.class.read_only_attributes(persisted?) end |
#resource_path ⇒ Object
Instance method extensions
166 167 168 |
# File 'lib/alula/resource_attributes.rb', line 166 def resource_path self.class.resource_path end |
#to_key ⇒ Object
200 201 202 203 |
# File 'lib/alula/resource_attributes.rb', line 200 def to_key key = respond_to?(:id) && id key ? [key] : nil end |
#type(arg) ⇒ Object
170 171 172 |
# File 'lib/alula/resource_attributes.rb', line 170 def type(arg) self.class.type(arg) end |