Class: Lolita::Configuration::Reports

Inherits:
Object
  • Object
show all
Includes:
ObservedArray
Defined in:
lib/lolita-report/configuration/reports.rb

Instance Method Summary collapse

Constructor Details

#initialize(dbi, *args, &block) ⇒ Reports

Returns a new instance of Reports.



9
10
11
12
13
14
# File 'lib/lolita-report/configuration/reports.rb', line 9

def initialize dbi,*args,&block
  @dbi=dbi
  @reports=[]
  self.instance_eval(&block) if block_given?
  #        self.set_attributes(*args)
end

Instance Method Details

#add(*args, &block) ⇒ Object

Add Lolita::Configuration::Report object to Lolita::Configuration::Reports object



17
18
19
20
21
# File 'lib/lolita-report/configuration/reports.rb', line 17

def add *args,&block
  report=Lolita::Configuration::Report.new(@dbi,*args,&block)
  report.title=args[0]
  self<<report
end

#by_name(name) ⇒ Object



28
29
30
# File 'lib/lolita-report/configuration/reports.rb', line 28

def by_name(name)
  @reports.detect{|report| report.name==name}
end

#titlesObject

Return all titles of all Lolita::Configuration::Report objetc, which contains Lolita::Configuration::Reports object



24
25
26
# File 'lib/lolita-report/configuration/reports.rb', line 24

def titles
  @reports.map(&:title)
end