Sha256: 3eee4518500f03847375117251ee0df5563a7cff627f1fbe17701a4c4637a4dc
Contents?: true
Size: 1.02 KB
Versions: 6
Compression:
Stored size: 1.02 KB
Contents
module Ice class BaseCube extend Ice::CubeAssociation def self.revealing(* attributes) unless @attribute_names @attribute_names = [] end @attribute_names.concat(attributes) attributes.each do |attr| define_method attr.to_sym do @source.send(attr).to_ice end end end attr_reader :source def to_ice self end def to_hash if @attribute_names hash = {:id => @source.id} @attribute_names && @attribute_names.each do |name| hash[name] = @source.send(name) end hash else @hash = @source.serializable_hash end end def id @source.id end def initialize(source) @source = source unless @attribute_names to_hash.each_key do |key| unless self.respond_to? key.to_sym self.class.send :define_method, key.to_sym do @source.send(key.to_sym) end end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
ice-0.5.0 | lib/ice/base_cube.rb |
ice-0.4.4 | lib/ice/base_cube.rb |
ice-0.4.3 | lib/ice/base_cube.rb |
ice-0.4.2 | lib/ice/base_cube.rb |
ice-0.4.1 | lib/ice/base_cube.rb |
ice-0.4.0 | lib/ice/base_cube.rb |