app/models/run.rb
# transform to Run active entity, no save to DB as put does.
# "default_since" is forced since as default
#   "if default_since" is nil, since is unchanged.
transform to Run active entity, no save to DB as put does.
"default_since" is forced since as default
"if default_since" is nil, since is unchanged.
transform to Run active entity no save to DB as put does . " default_since " is forced since as default " if default_since " is nil since is unchanged .
def to_entity(default_since = nil)
    (value = content[Run::Literal.to_s])  and return value
    (value = content[Run::Per_Se.to_s]) and return model.find(value.to_i)
    pure_entity = model.find_entity(entity_id)
    default_since and pure_entity.since = default_since
    receiver = model.new
    content.each_key do |attr|
      receiver.respond_to?("#{attr}=") and receiver.send("#{attr}=", content[attr.to_s])
    end
    receiver._assoc_dependee.to_a.each do |assoc|
      pure_entity.send("#{assoc.assoc_name}=", assoc.map(&:to_entity_ref).map(&:to_entity))
    end
    receiver._assoc_dependant.to_a.each do |assoc|
      entity_hash_list = assoc.is_a?(Array) ? assoc.first : assoc
      value = 
        entity_hash_list.keys.inject([]) do |sum, key|
          sum << {key => entity_hash_list[key]}.to_entity_ref.to_entity(default_since)
        end
      pure_entity.send("#{assoc.assoc_name}=", value)
    end
    return pure_entity
  end
def to_entity ( default_since = nil ) ( value = content [ Run :: Literal . to_s ] ) and return value ( value = content [ Run :: Per_Se . to_s ] ) and return model . find ( value . to_i ) pure_entity = model . find_entity ( entity_id ) default_since and pure_entity . since = default_since receiver = model . new content . each_key do | attr | receiver . respond_to? ( "#{attr}=" ) and receiver . send ( "#{attr}=" , content [ attr . to_s ] ) end receiver . _assoc_dependee . to_a . each do | assoc | pure_entity . send ( "#{assoc.assoc_name}=" , assoc . map ( & :to_entity_ref ) . map ( & :to_entity ) ) end receiver . _assoc_dependant . to_a . each do | assoc | entity_hash_list = assoc . is_a? ( Array ) ? assoc . first : assoc value = entity_hash_list . keys . inject ( [ ] ) do | sum , key | sum << { key => entity_hash_list [ key ] } . to_entity_ref . to_entity ( default_since ) end pure_entity . send ( "#{assoc.assoc_name}=" , value ) end return pure_entity end
transform to Run active entity, no save to DB as put does.
transform to Run active entity no save to DB as put does .
# set value for only respondable attributes in content # assoc might be an array due to parameter construction by RAILS
default_since
<not_specific>