Sha256: e403cb4af31c60ca43acdeaae3accfd2ce882f2a2051847934a07664acd4483a
Contents?: true
Size: 887 Bytes
Versions: 2
Compression:
Stored size: 887 Bytes
Contents
module Fog class Model def initialize(attributes = {}) update_attributes(attributes) end def inspect data = "#<#{self.class.name}" for attribute in (self.instance_variables - ['@connection']) data << " #{attribute}=#{send(attribute[1..-1].to_sym).inspect}" end data << ">" end def update_attributes(attributes = {}) for key, value in attributes send(:"#{key}=", value) end self end private def connection=(new_connection) @connection = new_connection end def connection @connection end def new_record? !defined?(@new_record) || @new_record end def remap_attributes(attributes, mapping) for key, value in mapping if attributes[key] attributes[value] = attributes.delete(key) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
geemus-fog-0.0.1 | lib/fog/model.rb |
geemus-fog-0.0.3 | lib/fog/model.rb |