Sha256: 40b8ed02943f1742a84b65a7281f33834b377d896550ab21732f101b4bfb0e19

Contents?: true

Size: 623 Bytes

Versions: 3

Compression:

Stored size: 623 Bytes

Contents

module Chartio
  class TestFormatter

    attr_accessor :foreign_keys

    def initialize
      @foreign_keys = []
    end

    def <<(fk)
      @foreign_keys << fk
    end

    def output_report
      nil
    end

    def find_key(search_options = {})
      find(:find, search_options)
    end

    def find_keys(search_options = {})
      find(:find_all, search_options)
    end

    private

    def find(find_type, search_options)
      foreign_keys.send(find_type) { |x|
        search_options.inject(true) do |boolean, option|
          boolean && x.send(option[0]) == option[1]
        end
      }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chartio-rails-0.1.0 lib/chartio/test_formatter.rb
chartio-rails-0.0.2 lib/chartio/test_formatter.rb
chartio-rails-0.0.1 lib/chartio/test_formatter.rb