Sha256: 33bfb213ec76e4cfd2803a0aa5949fb5e8f682f9968b17070b003ad4d4c6c8a3

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

require 'dolly/mango'
require 'dolly/mango_index'
require 'dolly/query'
require 'dolly/view_query'
require 'dolly/connection'
require 'dolly/request'
require 'dolly/depracated_database'
require 'dolly/document_state'
require 'dolly/properties'
require 'dolly/document_type'
require 'dolly/identity_properties'
require 'dolly/attachment'
require 'dolly/property_manager'
require 'dolly/timestamp'
require 'dolly/query_arguments'
require 'dolly/document_creation'
require 'dolly/class_methods_delegation'
require 'refinements/string_refinements'

module Dolly
  class Document
    extend Mango
    extend Query
    extend ViewQuery
    extend Request
    extend DepracatedDatabase
    extend Properties
    extend DocumentCreation

    include DocumentType
    include PropertyManager
    include Timestamp
    include DocumentState
    include IdentityProperties
    include Attachment
    include QueryArguments
    include ClassMethodsDelegation

    attr_writer :doc

    def initialize(attributes = {})
      init_ancestor_properties
      properties.each(&build_property(attributes))
    end

    protected

    def doc
      @doc ||= {}
    end

    def init_ancestor_properties
      self.class.ancestors.map do |ancestor|
        begin
          ancestor.properties.entries.each do |property|
            properties << property
          end
        rescue NoMethodError => e
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dolly-3.1.0 lib/dolly/document.rb
dolly-3.0.1 lib/dolly/document.rb