Class: Reporter::DataSource
- Inherits:
-
Object
- Object
- Reporter::DataSource
- Defined in:
- lib/reporter/data_source.rb
Instance Attribute Summary collapse
-
#scopes ⇒ Object
readonly
Returns the value of attribute scopes.
-
#sources ⇒ Object
readonly
Returns the value of attribute sources.
Instance Method Summary collapse
- #<<(source) ⇒ Object (also: #add)
- #get(name) ⇒ Object
-
#initialize(*args) {|_self| ... } ⇒ DataSource
constructor
A new instance of DataSource.
Constructor Details
#initialize(*args) {|_self| ... } ⇒ DataSource
Returns a new instance of DataSource.
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
#scopes ⇒ Object (readonly)
Returns the value of attribute scopes.
20 21 22 |
# File 'lib/reporter/data_source.rb', line 20 def scopes @scopes end |
#sources ⇒ Object (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 |