Sha256: b7fb425ac297b33729030dbaadca5e778643e3002330a2f052f177cc72bd1b83

Contents?: true

Size: 803 Bytes

Versions: 55

Compression:

Stored size: 803 Bytes

Contents

module Appfuel
  module Memory
    class Mapper < Appfuel::Repository::Mapper

      def to_storage(domain, opts = {})
        excluded = opts[:exclude] || []

        data = {}
        each_entity_attr(domain.domain_name) do |entry|
          attr_name = entry.storage_attr
          next if excluded.include?(attr_name) || entry.skip?

          data[attr_name] = entity_value(domain, entry)
        end
        data
      end


      def exists?(criteria)
        domain_expr = criteria.exists_expr
        domain_name = domain_expr.domain_name
        domain_attr = domain_expr.domain_attr

        db_expr  = create_db_expr(domain_name, domain_attr)
        db_model = db_class_mapped(domain_name, domain_attr)
        db_model.exists?([db_expr.string, db_expr.values])
      end
    end
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
appfuel-0.7.0 lib/appfuel/storage/memory/mapper.rb
appfuel-0.6.16 lib/appfuel/storage/memory/mapper.rb
appfuel-0.6.15 lib/appfuel/storage/memory/mapper.rb
appfuel-0.6.14 lib/appfuel/storage/memory/mapper.rb
appfuel-0.6.13 lib/appfuel/storage/memory/mapper.rb
appfuel-0.6.12 lib/appfuel/storage/memory/mapper.rb
appfuel-0.6.11 lib/appfuel/storage/memory/mapper.rb
appfuel-0.6.10 lib/appfuel/storage/memory/mapper.rb
appfuel-0.6.9 lib/appfuel/storage/memory/mapper.rb
appfuel-0.6.8 lib/appfuel/storage/memory/mapper.rb
appfuel-0.6.7 lib/appfuel/storage/memory/mapper.rb
appfuel-0.6.6 lib/appfuel/storage/memory/mapper.rb
appfuel-0.6.5 lib/appfuel/storage/memory/mapper.rb
appfuel-0.6.4 lib/appfuel/storage/memory/mapper.rb
appfuel-0.6.3 lib/appfuel/storage/memory/mapper.rb
appfuel-0.6.1 lib/appfuel/storage/memory/mapper.rb
appfuel-0.5.16 lib/appfuel/storage/memory/mapper.rb
appfuel-0.5.15 lib/appfuel/storage/memory/mapper.rb
appfuel-0.5.14 lib/appfuel/storage/memory/mapper.rb
appfuel-0.5.13 lib/appfuel/storage/memory/mapper.rb