Sha256: 1481ce54348bf69c7db8fca34c1f735ea39f5d1e6c619fc767a65fdba272f3c1

Contents?: true

Size: 539 Bytes

Versions: 5

Compression:

Stored size: 539 Bytes

Contents

class Reporter::DataSource

	def initialize *args, &block
		@sources = []
		@scopes = Reporter::DataSource::Scoping.new self
		yield self if block_given?
	end

	def << source
		@sources << wrap_source(source)
		self
	end
	alias :add :<<

	def get name
		sources.detect { |source| source.name == name } or raise "Source #{name} not found"
	end

	attr_reader :scopes, :sources

	private

	def wrap_source source
		if source.ancestors.include? ActiveRecord::Base
			Reporter::DataSource::ActiveRecordSource.new(self, source)
		end
	end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
reporter-0.0.5 lib/reporter/data_source.rb
reporter-0.0.4 lib/reporter/data_source.rb
reporter-0.0.3 lib/reporter/data_source.rb
reporter-0.0.2 lib/reporter/data_source.rb
reporter-0.0.1 lib/reporter/data_source.rb