Sha256: 9fbfed8b1ec48f62f2b98fed9ef03bfbf9fecb255b8cc34867a4f986853216ae

Contents?: true

Size: 476 Bytes

Versions: 11

Compression:

Stored size: 476 Bytes

Contents

module CouchPotato
  module GhostAttributes
    def self.included(base)
      base.class_eval do
        attr_accessor :_document
        def self.json_create(json)
          instance = super
          instance._document = json if json
          instance
        end
        
        def method_missing(name, *args)
          if(value = _document && _document[name.to_s])
            value
          else
            super
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
langalex-couch_potato-0.2.11 lib/couch_potato/persistence/ghost_attributes.rb
langalex-couch_potato-0.2.12 lib/couch_potato/persistence/ghost_attributes.rb
couch_potato-0.2.20 lib/couch_potato/persistence/ghost_attributes.rb
couch_potato-0.2.19 lib/couch_potato/persistence/ghost_attributes.rb
couch_potato-0.2.18 lib/couch_potato/persistence/ghost_attributes.rb
couch_potato-0.2.17 lib/couch_potato/persistence/ghost_attributes.rb
couch_potato-0.2.16 lib/couch_potato/persistence/ghost_attributes.rb
couch_potato-0.2.15 lib/couch_potato/persistence/ghost_attributes.rb
couch_potato-0.2.14 lib/couch_potato/persistence/ghost_attributes.rb
couch_potato-0.2.13 lib/couch_potato/persistence/ghost_attributes.rb
couch_potato-0.2.12 lib/couch_potato/persistence/ghost_attributes.rb