Sha256: 8e5c443fa9b4affd3f99a14d724369c01eac9c65664b16137853f62ea9d2d32f

Contents?: true

Size: 955 Bytes

Versions: 1

Compression:

Stored size: 955 Bytes

Contents

# This is an alternative version of rom-fmp, with all moduels & classes in a single file.

require 'logger'
require 'rom'
require 'rfm'
require 'yaml'

class Rfm::Layout
  def to_a
    all(:max_records=>10)
  end
  
  def each
    # passes block - if any - to upstream each.
    to_a.each(&Proc.new)
  end
end

module ROM
  module FMP
  
  
    class Gateway < ROM::Gateway
      attr_reader :datasets
      
      def initialize(*options)
        @datasets = Rfm.database(options[0].to_h.merge(FMRESULTSET_TEMPLATE).to_h)
      end
      
      def dataset(name)
        datasets[name.to_s]
      end
      
      # This is required per lint specs
      alias_method :[], :dataset
      
      def dataset?(name)
        datasets.layouts.key?(name.to_s)
      end
    end
  
  
    class Relation < ROM::Relation
      # we must configure adapter identifier here
      adapter :fmp

      forward :find, :any, :all
    end

    



  end # FMP
end # ROM

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rom-fmp-0.0.4 lib/rom/fmp/micro01.rb