lib/ruby-lokalise-api/resources/base.rb
# Store all resources attributes under the corresponding instance variables.
# `ATTRIBUTES` is defined inside resource-specific classes
Store all resources attributes under the corresponding instance variables.
`ATTRIBUTES` is defined inside resource-specific classes
Store all resources attributes under the corresponding instance variables . ` ATTRIBUTES ` is defined inside resource - specific classes
def populate_attributes_for(content)
        return unless content
        data_key = data_key_for model_class: self.class.name.base_class_name
        self.class.const_get(:ATTRIBUTES).each do |attr|
          value = if content.key?(data_key) && content[data_key].is_a?(Hash)
                    content[data_key][attr]
                  else
                    content[attr]
                  end
          instance_variable_set "@#{attr}", value
        end
      end
def populate_attributes_for ( content ) return unless content data_key = data_key_for model_class : self . class . name . base_class_name self . class . const_get ( :ATTRIBUTES ) . each do | attr | value = if content . key? ( data_key ) && content [ data_key ] . is_a? ( Hash ) content [ data_key ] [ attr ] else content [ attr ] end instance_variable_set "@#{attr}" , value end end
Store all resources attributes under the corresponding instance variables.
Store all resources attributes under the corresponding instance variables .
content