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
195 196 197 |
# File 'lib/alula/resource_attributes.rb', line 195 def date_fields self.class.date_fields end |
#field_names ⇒ Object
181 182 183 |
# File 'lib/alula/resource_attributes.rb', line 181 def field_names self.class.field_names end |
#fields ⇒ Object
177 178 179 |
# File 'lib/alula/resource_attributes.rb', line 177 def fields self.class.fields end |
#get_type ⇒ Object
173 174 175 |
# File 'lib/alula/resource_attributes.rb', line 173 def get_type self.class.get_type end |
#persisted? ⇒ Boolean
185 186 187 |
# File 'lib/alula/resource_attributes.rb', line 185 def persisted? !self.id.nil? end |
#read_only_attributes ⇒ Object
189 190 191 |
# File 'lib/alula/resource_attributes.rb', line 189 def read_only_attributes self.class.read_only_attributes(persisted?) end |
#resource_path ⇒ Object
Instance method extensions
165 166 167 |
# File 'lib/alula/resource_attributes.rb', line 165 def resource_path self.class.resource_path end |
#to_key ⇒ Object
199 200 201 202 |
# File 'lib/alula/resource_attributes.rb', line 199 def to_key key = respond_to?(:id) && id key ? [key] : nil end |
#type(arg) ⇒ Object
169 170 171 |
# File 'lib/alula/resource_attributes.rb', line 169 def type(arg) self.class.type(arg) end |