Class: AppReport::Report::Jasper

Inherits:
Object
  • Object
show all
Defined in:
lib/app_report/report/jasper.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Jasper

Returns a new instance of Jasper.



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/app_report/report/jasper.rb', line 22

def initialize attributes = {}
  attributes = {
    :template_name    => nil,
    :data_type        => 'empty',
    :data             => '',
    :xpath_expression => '',
    :args             => {}
  }.merge attributes

  @attributes = attributes
end

Instance Method Details

#argsObject



56
57
58
# File 'lib/app_report/report/jasper.rb', line 56

def args
  @attributes[:args]
end

#attributesObject

attributes



36
37
38
# File 'lib/app_report/report/jasper.rb', line 36

def attributes
  @attributes.clone
end

#dataObject



48
49
50
# File 'lib/app_report/report/jasper.rb', line 48

def data
  @attributes[:data]
end

#data_typeObject



44
45
46
# File 'lib/app_report/report/jasper.rb', line 44

def data_type
  @attributes[:data_type]
end

#template_nameObject



40
41
42
# File 'lib/app_report/report/jasper.rb', line 40

def template_name
  @attributes[:template_name]
end

#validates_all_attributes!Object Also known as: validates!

validations



63
64
65
66
67
# File 'lib/app_report/report/jasper.rb', line 63

def validates_all_attributes!
  @attributes.each do |key, value|
    send "validates_#{key}!"
  end
end

#validates_args!Object



87
88
# File 'lib/app_report/report/jasper.rb', line 87

def validates_args!
end

#validates_data!Object



81
82
# File 'lib/app_report/report/jasper.rb', line 81

def validates_data!
end

#validates_data_type!Object



78
79
# File 'lib/app_report/report/jasper.rb', line 78

def validates_data_type!
end

#validates_presence_of!(option_name) ⇒ Object



70
71
72
# File 'lib/app_report/report/jasper.rb', line 70

def validates_presence_of! option_name
  raise AppReport::Errors::ValidationError, "#{option_name} is required" if send(option_name).blank?
end

#validates_template_name!Object



74
75
76
# File 'lib/app_report/report/jasper.rb', line 74

def validates_template_name!
  validates_presence_of! :template_name
end

#validates_xpath_expression!Object



84
85
# File 'lib/app_report/report/jasper.rb', line 84

def validates_xpath_expression!
end

#xpath_expressionObject



52
53
54
# File 'lib/app_report/report/jasper.rb', line 52

def xpath_expression
  @attributes[:xpath_expression]
end