class Nova::API::Utils::BaseStruct
Constants
- DATE_REGEX
Public Instance Methods
allowed_attributes()
click to toggle source
# File lib/nova/api/utils/base_struct.rb, line 12 def allowed_attributes return attributes unless self.class.const_defined?('ALLOWED_ATTRIBUTES') data = {} self.class.const_get('ALLOWED_ATTRIBUTES').each do |key| next unless attributes.keys.include? key value = attributes[key] data[key.to_sym] = extract_value(key, value) end data end
Private Instance Methods
extract_value(key, value)
click to toggle source
# File lib/nova/api/utils/base_struct.rb, line 30 def extract_value(key, value) value.is_a?(Array) ? value.map { |attribute| permit_value(key, attribute) } : permit_value(key, value) end
permit_value(key, value)
click to toggle source
# File lib/nova/api/utils/base_struct.rb, line 34 def permit_value(key, value) value.respond_to?(:allowed_attributes) ? value.allowed_attributes : value end