Class: AppReport::Report::Jasper
- Inherits:
-
Object
- Object
- AppReport::Report::Jasper
- Defined in:
- lib/app_report/report/jasper.rb
Instance Method Summary collapse
- #args ⇒ Object
-
#attributes ⇒ Object
attributes.
- #data ⇒ Object
- #data_type ⇒ Object
-
#initialize(attributes = {}) ⇒ Jasper
constructor
A new instance of Jasper.
- #template_name ⇒ Object
-
#validates_all_attributes! ⇒ Object
(also: #validates!)
validations.
- #validates_args! ⇒ Object
- #validates_data! ⇒ Object
- #validates_data_type! ⇒ Object
- #validates_presence_of!(option_name) ⇒ Object
- #validates_template_name! ⇒ Object
- #validates_xpath_expression! ⇒ Object
- #xpath_expression ⇒ Object
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
#args ⇒ Object
56 57 58 |
# File 'lib/app_report/report/jasper.rb', line 56 def args @attributes[:args] end |
#attributes ⇒ Object
attributes
36 37 38 |
# File 'lib/app_report/report/jasper.rb', line 36 def attributes @attributes.clone end |
#data ⇒ Object
48 49 50 |
# File 'lib/app_report/report/jasper.rb', line 48 def data @attributes[:data] end |
#data_type ⇒ Object
44 45 46 |
# File 'lib/app_report/report/jasper.rb', line 44 def data_type @attributes[:data_type] end |
#template_name ⇒ Object
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_expression ⇒ Object
52 53 54 |
# File 'lib/app_report/report/jasper.rb', line 52 def xpath_expression @attributes[:xpath_expression] end |