Class: Reporter::DataSource

Inherits:
Object
  • Object
show all
Defined in:
lib/reporter/data_source.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) {|_self| ... } ⇒ DataSource

Returns a new instance of DataSource.

Yields:

  • (_self)

Yield Parameters:



4
5
6
7
8
# File 'lib/reporter/data_source.rb', line 4

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

Instance Attribute Details

#scopesObject (readonly)

Returns the value of attribute scopes.



20
21
22
# File 'lib/reporter/data_source.rb', line 20

def scopes
  @scopes
end

#sourcesObject (readonly)

Returns the value of attribute sources.



20
21
22
# File 'lib/reporter/data_source.rb', line 20

def sources
  @sources
end

Instance Method Details

#<<(source) ⇒ Object Also known as: add



10
11
12
13
# File 'lib/reporter/data_source.rb', line 10

def << source
	@sources << wrap_source(source)
	self
end

#get(name) ⇒ Object



16
17
18
# File 'lib/reporter/data_source.rb', line 16

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